Python client library for AmCAT API
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
amcatclient
.gitignore
LICENSE
README.md
demo.py
demo_scraper.py
demo_wikinews_scraper.py
demo_wordcount.py
setup.cfg
setup.py

README.md

amcatclient

Client code for interfacing with the AmCAT API.

Installing

You can install amcatclient using pip:

pip install amcatclient

(Note that this requires that you either use sudo or a virtual environment)

You can also copy file amcatclient.py, which you can download or clone using git. Since his is licensed with the permissive MIT license, feel free to include this file in your own projects, whether open source or not.

Usage

You can include amcatclient to use the AmCAT API from a program. The client also contains useful scripts for managing AmCAT instances, currently only copy_articles.py

Client scripts

Copying aritcles:

You can copy articles from one server to another using the copy_articles script. Note that both servers need to be included in ~/.amcatauth for this to work.

python -m amcatclient.copy_articles http://preview.amcat.nl http://localhost:8000 1 3 1

API

from amcatclient import AmcatAPI
conn = AmcatAPI("http://amcat.vu.nl", username, password)

It is advised to create a .amcatauth file in your home directory, which should contain the hostname, username, password for the server(s) you want to use (comma separated, one server per line). In that case, you can omit the authentication info:

from amcatclient import AmcatAPI
conn = AmcatAPI("http://amcat.vu.nl")

See the source code for the API methods (sorry!). demo_wordcount.py shows how to use the client to retrieve a set of articles and count the words. demo_scraper.py shows a simple scraper that adds all State of the Union speeches to AmCAT.