Python 3k wrapper for the Twitter API
Wyvern is a Python 3 client for the Twitter REST API v1.1. At this time, only connections based on a full set of OAuth credentials (consumer_key, consumer_secret, access_token, access_token_secret) are supported; credentials can be obtained by setting up an application on https://dev.twitter.com.
A Wyvern client is setup using:
from wyvern import Wyvern w = Wyvern(consumer_key, consumer_secret, access_token, access_token_secret, headers=None, proxies=None, version=1.1)
Calls to the API have the following format:
response = w.method_name(**method_params)
Where method_name is a method corresponding to the Twitter API endpoint being queried, and method_params is a list of keyword-arg pairings corresponding to the required and optional parameters of the given endpoint, as well as to any variable values the endpoint may contain (such as :id).
Users can find the correct method for the endpoint(s) they with to use either by examining endpoints.py or by calling:
As of this point, endpoints involving media (upload and download) are not supported, nor are OAuth endpoints or the Streaming API. Media support should be coming soon, and streaming will be tackled after that.
The file test_wyvern.py is provided to ensure that the setup works; to run it, place a config.txt file in its directory and call python3 test_wyvern.py. The config file must have the format:
[Twitter] consumer_key0: <fill-in> consumer_secret0: <fill-in> access_token0: <fill-in> access_token_secret0: <fill-in> consumer_key1: <fill-in> consumer_secret1: <fill-in> access_token1: <fill-in> access_token_secret1: <fill-in> ... 2, 3, 4 ... consumer_key5: <fill-in> consumer_secret5: <fill-in> access_token5: <fill-in> access_token_secret5: <fill-in>
In this, applications 0 and 1 must have read/write/direct message access, applications 2 and 3 must have read/write access, and applications 4 and 5 must have read access. It’s a somewhat convoluted process, but for security reasons I’m not going to release my personal config info. Sorry guys.
Even if you’re not willing to go through the process of setting up the accounts, the test code contains a lot of good examples on how to use Wyvern.
Wyvern is distributed under the MIT License - see LICENSE.txt for more info.
Depending on your Python setup, Wyvern can be installed by using one of:
(pip | pip3) install wyvern
It can also be installed by cloning the git repo:
git clone git://github.com/danxmoran/wyvern.git cd wyvern sudo python3 setup.py install
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size wyvern-0.1.0.tar.gz (8.4 kB)||File type Source||Python version None||Upload date||Hashes View hashes|