Updated for OAuth

Updated Twython Documentation (textile)
ryanmcgrath 2010-10-25 19:36:24 -07:00
parent f88818e64e
commit a2704274c3

@ -1,23 +1,33 @@
h1. Twython Documentation h1. Twython Overview (IMPORTANT)
Twython covers Twitter's API in (what is hopefully) full. It should be fairly self explanatory; documentation is split up in parts relating to each set of functions. Twython's API documentation tries to mirror "Twitter's API documentation":http://apiwiki.twitter.com/Twitter-API-Documentation in some manner. With that said, before using Twython, it's worth reading through Twitters "guide on things every Twitter developer should know":http://apiwiki.twitter.com/Things-Every-Developer-Should-Know. Twython covers Twitter's API in (what is hopefully) full. It should be fairly self explanatory; documentation is split up in parts relating to each set of functions. Twython's API documentation tries to mirror "Twitter's API documentation":http://apiwiki.twitter.com/Twitter-API-Documentation in some manner. With that said, before using Twython, it's worth reading through Twitters "guide on things every Twitter developer should know":http://apiwiki.twitter.com/Things-Every-Developer-Should-Know.
h1. The basics of using Twython Every argument to a function in Twython is a one to one mapping of the named parameters Twitter accepts in their API. An example is:
Twython was designed to be quick and easy to use. Before you can use any of the API methods, though, you need to create an instance of Twython. When creating an instance of Twython to reference, there's a few things worth noting. You can choose to instantiate Twython with no Authentication, OAuth-based Authentication (soon), or Basic (HTTP) Authentication. Twitter's search API accepts queries under the keyword "q", so we'll pass it like so:
<pre> <pre>
<code> <code>
import twython from twython import Twython
twitter = Twython()
twitter.searchTwitter(q="my search query")
</code>
</pre>
h1. The basics of using Twython
Twython was designed to be quick and easy to use. Before you can use any of the API methods, though, you need to create an instance of Twython. When creating an instance of Twython to reference, there's a few things worth noting. You can choose to instantiate Twython with no Authentication, or use OAuth-based Authentication. Basic Authentication was deprecated by Twitter back in August of 2010.
To set up an OAuth application, feel free to use/adapt the included Django OAuth Twitter example that uses Twython.
<pre>
<code>
from twython import Twython
# Using no authentication # Using no authentication
twitter = twython.core.setup() twitter = Twython()
# Using Basic Authentication # For OAuth examples, see the included Django application.
twitter = twython.core.setup(username="example", password="example")
# Using Basic Authentication and adding custom HTTP Headers
twitter = twython.core.setup(username="example",
password="example", headers="your_headers_here")
</code> </code>
</pre> </pre>