1. Jeremy Rossi
  2. tweethon


tweethon /

Filename Size Date modified Message
79 B
Make the hgignore not display OS X Files
51 B
Added tag 0.7-devel for changeset 006b20721057
2.4 KB
Added page parameter to GetReplies, GetFriends, GetFollowers, and GetDirectMessages
582 B
Initial commit of python-twitter.
11.4 KB
Initial commit of python-twitter.
301 B
Require simplejson 2.0.7 or later, include a local copy of the library, and indicate its source in a NOTICE file.
4.1 KB
more name changes
2.6 KB
upping the version number for release
97.3 KB
The objects return can be changed for all methods of Api
1.2 KB
upping the version number for release
28.6 KB
updating the code for work correct fro getFriends

-- markdown --

# Python Twitter #

_A python wrapper around the Twitter API_

  • Author: Jeremy Rossi <jeremy@jeremyrossi.com>
  • Org Author: DeWitt Clinton <dewitt@google.com>

## Introduction ##

This library provides a pure python interface for the Twitter API.

Twitter (http://twitter.com) provides a service that allows people to connect via the web, IM, and SMS. Twitter exposes a web services API (http://twitter.com/help/api) and this library is intended to make it even easier for python programmers to use.

## Building ##

### From source: ###

Install the dependencies:

Download the latest tweethonlibrary from:

Untar the source distribution and run:

$ python setup.py build $ python setup.py install

### Testing: ###

With setuptools installed:

$ python setup.py test

Without setuptools installed:

$ python tweethon_test.py

## Getting the code ##

View the trunk at:


Check out the latest development version anonymously with mercurial:

$ hg clone http://bitbucket.org/jrossi/tweethon/

## Documentation ##

View the last release API documentation at:

## Using ##

The library provides a python wrapper around the Twitter API and the twitter data model.

### Model: ###

The three model classes are twitter.Status, twitter.User, and twitter.DirectMessage. The API methods return instances of these classes.

To read the full API for twitter.Status, twitter.User, or twitter.DirectMessage, run:

$ pydoc tweethon.Status $ pydoc tweethon.User $ pydoc tweethon.DirectMessage

### API: ###

The API is exposed via the twitter.Api class.

To create an instance of the twitter.Api class:

>>> import tweethong
>>> api = tweethon.Api()

To create an instance of the twitter.Api with login credentials (many API calls required the client to be authenticated):

>>> api = tweethon.Api(username='username', password='password)

To fetch the most recently posted public twitter status messages:

>>> statuses = api.GetPublicTimeline()
>>> print [s.user.name for s in statuses]
[u'DeWitt', u'Kesuke Miyagi', u'ev', u'Buzz Andersen', u'Biz Stone']

To fetch a single user's public status messages, where "user" is either a Twitter "short name" or their user id.

>>> statuses = api.GetUserTimeline(user)
>>> print [s.text for s in statuses]

To fetch a list a user's friends (requires authentication):

>>> users = api.GetFriends()
>>> print [u.name for u in users]

To post a twitter status message (requires authentication):

>>> status = api.PostUpdate(username, password, 'I love python-twitter!')
>>> print status.text
I love python-twitter!

There are many more API methods, to read the full API documentation:

$ pydoc tweethon.Api

## Convert from python-twitter ##

PyTwitter is a complete fork of the python-twitter codebase. I am planning on keeping tweethon as drop in replacement for python-twitter. To make this work seamlessly use the following import idiom:

>>> import tweethon as twitter

## More Information ##

## Contributors ##

Additional thanks to Pierre-Jean Coudert, Omar Kilani, Jodok Batlogg, edleaf,glen.tregoning, Brad Choate, Jim Cortez, Jason Lemoine, Thomas Dyson, Robert Laquey, and the rest of the python-twitter mailing list.

## License ##

> Copyright 2007 Google Inc. All Rights Reserved. > > Licensed under the Apache License, Version 2.0 (the 'License'); > you may not use this file except in compliance with the License. > You may obtain a copy of the License at > > http://www.apache.org/licenses/LICENSE-2.0 > > Unless required by applicable law or agreed to in writing, software > distributed under the License is distributed on an 'AS IS' BASIS, > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > See the License for the specific language governing permissions and > limitations under the License.