Welcome to Cabu’s documentation!

Cabu is a simple framework to create crawling microservices.

Jean Cabut (1938 – 2015), known by the pen-name Cabu, was a French caricaturist. He died in the January 2015 shooting attack at the Charlie Hebdo offices. Today he still stands as a source of inspiration for many people in France.

Introduction

Following the philosophy of Python, Cabu wants to be easy to use and simple to understand. It’s suitable for deployment on modern cloud platforms and constructed as a modular package so you can start with the default setup or customize pretty much everything. It’s also based on Flask and Selenium and works on Python interpreter versions prior to 2.6 (including PyPy).

No more talk :

No headaches

This is a simple example of how to define an endpoint to get the list of last Gizmodo articles :

from cabu import Cabu

app = Cabu(__name__)

@app.route('/gizmodo_last_articles_links')
def gizmodo_last_articles():
    app.webdriver.get('http://www.gizmodo.com')
    articles_links = [
        i.get_attribute('href')
        for i in app.webdriver.find_elements_by_css_selector('h1.headline>a')
    ]

    return jsonify({'message': 'Last articles', 'articles': articles_links})

app.run()