Python wrapper for the Mastodon (https://github.com/mastodon/mastodon) API.
6067aa4604
Mastodon can be configured to use another address for streaming server-side. Such a setup is common with certain deployments. However, due to a bug, Mastodon does not properly issue HTTP redirects for anything but the endpoint /api/v1/streaming (including subdirs). It instead gives a 404, causing the request to fail. The workaround is to hit this path first, checking for any redirects, and modifying the URL accordingly. This commit also includes a workaround for behaviour in requests that causes it to strip the Authorization header from redirected requests. This is intentional behaviour on the part of requests, but breaks the redirection done by Mastodon. Fixes #84 |
||
---|---|---|
docs | ||
mastodon | ||
tests | ||
.gitignore | ||
CHANGELOG.rst | ||
DEVELOPMENT.md | ||
LICENSE | ||
MANIFEST.in | ||
README.rst | ||
setup.cfg | ||
setup.py |
Mastodon.py =========== .. code-block:: python from mastodon import Mastodon # Register app - only once! ''' Mastodon.create_app( 'pytooterapp', api_base_url = 'https://mastodon.social', to_file = 'pytooter_clientcred.secret' ) ''' # Log in - either every time, or use persisted ''' mastodon = Mastodon( client_id = 'pytooter_clientcred.secret', api_base_url = 'https://mastodon.social' ) mastodon.log_in( 'my_login_email@example.com', 'incrediblygoodpassword', to_file = 'pytooter_usercred.secret' ) ''' # Create actual API instance mastodon = Mastodon( client_id = 'pytooter_clientcred.secret', access_token = 'pytooter_usercred.secret', api_base_url = 'https://mastodon.social' ) mastodon.toot('Tooting from python using #mastodonpy !') Python wrapper for the Mastodon ( https://github.com/tootsuite/mastodon/ ) API. Feature complete for public API as of version v1.6 and easy to get started with. You can install Mastodon.py via pypi: .. code-block:: Bash # Python 2 pip install Mastodon.py # Python 3 pip3 install Mastodon.py Full documentation and basic usage examples can be found at http://mastodonpy.readthedocs.io/en/latest/ .