Examples::
- twitter = Twitter("hello@foo.com", "password123")
+ twitter = Twitter(
+ auth=OAuth(token, token_key, con_secret, con_secret_key)))
# Get the public timeline
twitter.statuses.public_timeline()
user="billybob",
text="I think yer swell!")
+
Searching Twitter::
twitter_search = Twitter(domain="search.twitter.com")
"""
def __init__(
self, email=None, password=None, format="json",
- domain="api.twitter.com", agent=None, secure=True, auth=None,
- api_version=1):
+ domain="twitter.com", agent=None, secure=True, auth=None,
+ api_version=''):
"""
Create a new twitter API connector.
Pass an `auth` parameter to use the credentials of a specific
user. Generally you'll want to pass an `OAuth`
- instance. Alternately you can pass `email` and `password`
- parameters but this authentication mode will be deactive by
- Twitter in the future and is not recommended.
+ instance::
+
+ twitter = Twitter(auth=OAuth(
+ token, token_secret, consumer_key, consumer_secret))
+
+
+ Alternately you can pass `email` and `password` parameters but
+ this authentication mode will be deactive by Twitter very soon
+ and is not recommended::
+
+ twitter = Twitter(email="blah@blah.com", password="foobar")
+
`domain` lets you change the domain you are connecting. By
default it's twitter.com but `search.twitter.com` may be
header. This is deprecated. Instead Twitter determines the
application using the OAuth Client Key and Client Key Secret
parameters.
+
+ `api_version` is used to set the base uri. By default it's
+ nothing, but if you set it to '1' your URI will start with
+ '1/'.
"""
if email is not None or password is not None:
if auth:
- raise (
+ raise ValueError(
"Can't specify 'email'/'password' and 'auth' params"
" simultaneously.")
auth = UserPassAuth(email, password)