Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Python 3k wrapper for the Twitter API

Project description

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.

Usage

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:

Wyvern.method_for_endpoint(endpoint)

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.

Testing

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.

License

Wyvern is distributed under the MIT License - see LICENSE.txt for more info.

Installation

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

Project details


Release history Release notifications

This version
History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
wyvern-0.1.0.tar.gz (8.4 kB) Copy SHA256 hash SHA256 Source None Feb 26, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page