Actively maintained, pure Python wrapper for the Twitter API. Supports both normal and streaming Twitter APIs. http://stackoverflow.com/questions/tagged/twython
Find a file
2010-12-13 14:26:49 +09:00
core_examples in get method we use *kwargs, that's why we need to provide named arguments to the function 2010-11-10 07:33:10 -08:00
twython Fix for searchTwitterGen search_query parameter, spotted (again) by Jacob Silterra 2010-12-13 14:26:49 +09:00
twython-django@fab3d7a216 Moved twython-django to be a submodule, better references everything this way (no need to ship useless, bloated code with a release). Twython 1.3.5 will not ship with the extra Django code, as it's now in its own separate repository (this is better, email if you have questions, happy to answer). 2010-11-07 02:20:56 -05:00
twython3k Fix a shortenURL reference bug pointed out by Jacob, incremental release of latest bugfixes because Pypi's been down recently 2010-12-12 14:45:03 +09:00
.gitignore Adding blocking for vim swap files. 2010-08-18 14:36:00 +08:00
.gitmodules Moved twython-django to be a submodule, better references everything this way (no need to ship useless, bloated code with a release). Twython 1.3.5 will not ship with the extra Django code, as it's now in its own separate repository (this is better, email if you have questions, happy to answer). 2010-11-07 02:20:56 -05:00
LICENSE Fix years 2010-10-22 12:43:50 -04:00
MANIFEST.in Redid some examples, moved examples to core_examples to differentiate from oauth_django_example, version bump to 1.3.2 to fix distribution errors with Pip/etc (dumb binaries were being created earlier, just throwing out the source now and letting pip handle it) 2010-10-19 16:31:09 -04:00
README.markdown Fix one final piece 2010-10-16 23:40:24 -04:00
README.txt Redid some examples, moved examples to core_examples to differentiate from oauth_django_example, version bump to 1.3.2 to fix distribution errors with Pip/etc (dumb binaries were being created earlier, just throwing out the source now and letting pip handle it) 2010-10-19 16:31:09 -04:00
setup.py Fix a shortenURL reference bug pointed out by Jacob, incremental release of latest bugfixes because Pypi's been down recently 2010-12-12 14:45:03 +09:00

Twython - Easy Twitter utilities in Python
=========================================================================================
Ah, Twitter, your API used to be so awesome, before you went and implemented the crap known
as OAuth 1.0. However, since you decided to force your entire development community over a barrel
about it, I suppose Twython has to support this. So, that said...

If you used this library and it all stopped working, it's because of the Authentication method change.
=========================================================================================================
Twitter recently disabled the use of "Basic Authentication", which is why, if you used Twython previously,
you probably started getting a ton of 401 errors. To fix this, we should note one thing...
 
You need to change how authentication works in your program/application. If you're using a command line
application or something, you'll probably languish in hell for a bit, because OAuth wasn't really designed
for those types of use cases. Twython cannot help you with that or fix the annoying parts of OAuth.

If you need OAuth, though, Twython now supports it, and ships with a skeleton Django application to get you started.
Enjoy!

Requirements
-----------------------------------------------------------------------------------------------------
Twython (for versions of Python before 2.6) requires a library called
"simplejson". Depending on your flavor of package manager, you can do the following... 

    (pip install | easy_install) simplejson

Twython also requires the (most excellent) OAuth2 library for handling OAuth tokens/signing/etc. Again...

    (pip install | easy_install) oauth2

Installation
-----------------------------------------------------------------------------------------------------
Installing Twython is fairly easy. You can...

    (pip install | easy_install) twython  

...or, you can clone the repo and install it the old fashioned way.

    git clone git://github.com/ryanmcgrath/twython.git  
    cd twython  
    sudo python setup.py install  

Example Use
-----------------------------------------------------------------------------------------------------
    from twython import Twython  
    
    twitter = Twython()  
    results = twitter.searchTwitter(q="bert")  
    
    # More function definitions can be found by reading over twython/twitter_endpoints.py, as well  
    # as skimming the source file. Both are kept human-readable, and are pretty well documented or  
    # very self documenting.  
    
A note about the development of Twython (specifically, 1.3)
----------------------------------------------------------------------------------------------------
As of version 1.3, Twython has been extensively overhauled. Most API endpoint definitions are stored
in a separate Python file, and the class itself catches calls to methods that match up in said table.

Certain functions require a bit more legwork, and get to stay in the main file, but for the most part
it's all abstracted out. 

As of Twython 1.3, the syntax has changed a bit as well. Instead of Twython.core, there's a main
Twython class to import and use. If you need to catch exceptions, import those from twython as well.

Arguments to functions are now exact keyword matches for the Twitter API documentation - that means that
whatever query parameter arguments you read on Twitter's documentation (http://dev.twitter.com/doc) gets mapped
as a named argument to any Twitter function.

For example: the search API looks for arguments under the name "q", so you pass q="query_here" to searchTwitter().

Doing this allows us to be incredibly flexible in querying the Twitter API, so changes to the API aren't held up
from you using them by this library.

Twython 3k
-----------------------------------------------------------------------------------------------------
There's an experimental version of Twython that's made for Python 3k. This is currently not guaranteed
to work (especially with regards to OAuth), but it's provided so that others can grab it and hack on it. 
If you choose to try it out, be aware of this.


Questions, Comments, etc?
-----------------------------------------------------------------------------------------------------
My hope is that Twython is so simple that you'd never *have* to ask any questions, but if
you feel the need to contact me for this (or other) reasons, you can hit me up 
at ryan@venodesigns.net.

Twython is released under an MIT License - see the LICENSE file for more information.