jprioli / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

I can not login #177

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Trying to login using python-twitter

I'm using python twitter 0.6 installed with easy_python on Windows 7. The 
dependences was installed using easy_python too.
Python 2.6

I'm trying:
>>> api = twitter.Api(username='my_acess_token_key',password='my_token_secret') 
#i've read in somewhere: use acess token

>>> users=api.GetFriends()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build\bdist.win32\egg\twitter.py", line 1583, in GetFriends
  File "build\bdist.win32\egg\twitter.py", line 2032, in _FetchUrl
  File "C:\Python26\lib\urllib2.py", line 397, in open
    response = meth(req, response)
  File "C:\Python26\lib\urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python26\lib\urllib2.py", line 435, in error
    return self._call_chain(*args)
  File "C:\Python26\lib\urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "C:\Python26\lib\urllib2.py", line 518, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request

--------------------------------------------------------------------

or, using my user and login:
>>> api = twitter.Api(username='user',password='password')
>>> users=api.GetFriends()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build\bdist.win32\egg\twitter.py", line 1583, in GetFriends
  File "build\bdist.win32\egg\twitter.py", line 2032, in _FetchUrl
  File "C:\Python26\lib\urllib2.py", line 397, in open
    response = meth(req, response)
  File "C:\Python26\lib\urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python26\lib\urllib2.py", line 435, in error
    return self._call_chain(*args)
  File "C:\Python26\lib\urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "C:\Python26\lib\urllib2.py", line 518, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 401: Unauthorized

----------------------------------------------------------------------
or...

>>> api = twitter.Api(consumer_key='',
consumer_secret='',
access_token_key=''
,access_token_secret='')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'access_token_key'

So... Could anyone help me? 
Thank you

Original issue reported on code.google.com by henry...@gmail.com on 24 Nov 2010 at 8:27

GoogleCodeExporter commented 8 years ago
Basic-Auth is no longer supported by Twitter, and python-twitter doesn't 
support OAuth.

Try this instead:

http://mike.verdone.ca/twitter/

Original comment by chri...@gmail.com on 2 Dec 2010 at 11:53

GoogleCodeExporter commented 8 years ago
I don't mind if folks mention other twitter libs (heck, encourage it) but 
please do make sure you are accurate...

python-twitter DOES support OAuth, but right now it's in the source version as 
we haven't pushed a new distribution yet.

Original comment by bear42 on 8 Dec 2010 at 12:58

GoogleCodeExporter commented 8 years ago

Original comment by bear42 on 8 Dec 2010 at 1:00

GoogleCodeExporter commented 8 years ago
OK, I give up. Why doesn't this work (replacing keys with correct values) I get 
the error message:
TypeError: __init__() got an unexpected keyword argument 'access_token_key'

This is a trimmed down version of your tweet.py example. ???

Any idea how I can see what version of  python-twitter "apt-get install  
python-twitter" got me?
============================
import twitter

access_key="abc"
access_secret="xyz"
consumer_key="123"
consumer_secret="456"
message="Good Morning!"
encoding = None

api = twitter.Api(consumer_key=consumer_key, consumer_secret=consumer_secret,
                  access_token_key=access_key, access_token_secret=access_secret,
                  input_encoding=encoding)

try:
    status = api.PostUpdate(message)
except UnicodeDecodeError:
    print "Your message could not be encoded.  Perhaps it contains non-ASCII characters? "
    print "Try explicitly specifying the encoding with the --encoding flag"
    sys.exit(2)
print "%s just posted: %s" % (status.user.name, status.text)

Original comment by rick.dea...@gmail.com on 20 Sep 2011 at 10:02