Issue 161 in python-twitter: HTTP Error 401 every time.

10 views
Skip to first unread message

python-...@googlecode.com

unread,
Sep 14, 2010, 6:05:12 AM9/14/10
to python-twi...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 161 by pete.doughty: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

What steps will reproduce the problem?
1. install simplejson and python-twitter (...duh)
2. run the following:
api = twitter.Api(username = '[correct uname', password = '[correct...
pwd]')
api.PostUpdate('word')
3. receive HTTPError: HTTP Error 401: Unauthorized

What is the expected output? What do you see instead?
I was expecting a new tweet on the account, consisting of "word". Instead,
I get that 401 error every single time. This first occurred about a week
and a half ago in a program that had been working fine for the preceding
couple of months.

What version of the product are you using? On what operating system?
Python 2.4 on XP, simplejson 2.0.9, python-twitter 0.5.
Then switched to simplejson 2.1.1, python-twitter 0.6, in case there was a
problem with one of the older versions.

Please provide any additional information below.
I suspect this is twitters problem rather than python-twitter's. But any
light (at all) that could be shed on it would help.


python-...@googlecode.com

unread,
Sep 14, 2010, 6:09:03 AM9/14/10
to python-twi...@googlegroups.com

Comment #1 on issue 161 by pete.doughty: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

A bit more detail: the full error response I get is:

File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line
307, in RunScript
debugger.run(codeObject, __main__.__dict__, start_stepping=0)

File "C:\Python24\Lib\site-packages\pythonwin\pywin\debugger\__init__.py",
line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)

File "C:\Python24\Lib\site-packages\pythonwin\pywin\debugger\debugger.py",
line 631, in run
exec cmd in globals, locals
File "C:\Documents and Settings\Peter Doughty\My Documents\Work\Python
Scripts\temp.py", line 15, in ?
api.PostUpdate('word')
File "build\bdist.win32\egg\twitter.py", line 1494, in PostUpdate
File "build\bdist.win32\egg\twitter.py", line 2018, in _FetchUrl
File "C:\Python24\lib\urllib2.py", line 364, in open
response = meth(req, response)
File "C:\Python24\lib\urllib2.py", line 471, in http_response
response = self.parent.error(
File "C:\Python24\lib\urllib2.py", line 402, in error
return self._call_chain(*args)
File "C:\Python24\lib\urllib2.py", line 337, in _call_chain
result = func(*args)
File "C:\Python24\lib\urllib2.py", line 480, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)


HTTPError: HTTP Error 401: Unauthorized

I have checked and rechecked the username and password.

s_kelley

unread,
Sep 14, 2010, 8:08:07 AM9/14/10
to python-twitter
I too am having this same issue.

On Sep 14, 6:09 am, python-twit...@googlecode.com wrote:
> Comment #1 on issue 161 by pete.doughty: HTTP Error 401 every time.http://code.google.com/p/python-twitter/issues/detail?id=161

python-...@googlecode.com

unread,
Sep 14, 2010, 2:41:31 PM9/14/10
to python-twi...@googlegroups.com

Comment #2 on issue 161 by MrFuzzemz: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

Hi Pete,
You are right that the problem is with twitter rather than python-twitter
for the most part. Twitter has changed its authorization method
from "username and password" to using oauth which requires a key and a
secret. They've phased out the old method and python-twitter hasn't made a
stable release utilizing this method. You can use
http://code.google.com/p/oauth-python-twitter/ instead while waiting for
the new python-twitter release.

yaemog Dodigo

unread,
Sep 14, 2010, 12:33:02 PM9/14/10
to python-...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "python-twitter" group.
To post to this group, send email to python-...@googlegroups.com.
To unsubscribe from this group, send email to python-twitte...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/python-twitter?hl=en.


yaemog Dodigo

unread,
Sep 14, 2010, 12:32:35 PM9/14/10
to python-...@googlegroups.com

Sounds like you're not using oAuth which twitter requires since about two weeks. Check that there is oauth support in your python-twitter version. If there is no oAuth support try upgrading to a more recent version.

--y

python-...@googlecode.com

unread,
Oct 16, 2010, 3:54:51 AM10/16/10
to python-twi...@googlegroups.com
Updates:
Status: Invalid

Comment #3 on issue 161 by bear42: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

Please try this with the very latest code double-checking that 1) you are
using oAuth key/secret values and that the simplegeo fork of python-oauth2
is used. I had made a mistake in the docs pointing everyone to another
oauth2 lib.

python-...@googlecode.com

unread,
Oct 17, 2010, 9:01:15 PM10/17/10
to python-twi...@googlegroups.com

Comment #4 on issue 161 by j.siemiatkowski: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

so just instead of username/password we use the key/secret ?

python-...@googlecode.com

unread,
Oct 18, 2010, 1:36:46 AM10/18/10
to python-twi...@googlegroups.com

Comment #5 on issue 161 by bear42: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

yes - the latest code has been updated to use those parameter names now.

python-...@googlecode.com

unread,
Oct 23, 2010, 3:00:18 PM10/23/10
to python-twi...@googlegroups.com

Comment #6 on issue 161 by WSchlauch: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

pretty sure you forgot to upload it - because with the version i downloaded
it does not work - at least not python-twitter. will try oauth-twitter from
you guys, but this is kinda hard to get around with if it is a distributed
all over the place. should have a notice on the start page, something
redirecting, if you want everyone to use oauth

python-...@googlecode.com

unread,
Oct 23, 2010, 3:04:20 PM10/23/10
to python-twi...@googlegroups.com

Comment #7 on issue 161 by WSchlauch: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

addendum: perhaps an update to you examples on the front page might be nice?

python-...@googlecode.com

unread,
Oct 26, 2010, 9:14:03 AM10/26/10
to python-twi...@googlegroups.com

Comment #8 on issue 161 by mukherjee.tanmoy: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

i have been getting the same issues again and again.... has the changes
been committed to use the token key and password

python-...@googlecode.com

unread,
Nov 5, 2010, 1:25:38 PM11/5/10
to python-twi...@googlegroups.com

Comment #9 on issue 161 by dom747: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

I installed this yesterday and gave up on getting auth to work. The
examples on the web page or the ones included with the packages don't work.
There are no good examples for using oauth in oauth-twitter either. I gave
up and used tweepy
http://jeffmiller.github.com/2010/05/31/twitter-from-the-command-line-in-python-using-oauth

When will there be a new release of python-twitter to fix this?

python-...@googlecode.com

unread,
Nov 5, 2010, 1:47:51 PM11/5/10
to python-twi...@googlegroups.com

Comment #10 on issue 161 by bear42: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

I really don't understand why you all are saying that python-twitter
doesn't support oauth. Sure it may only be in the trunk right now, but you
can follow the notes in the README which says that Twitter now only
supports oAuth and the Twitter docs about oAuth describe how to get your
consumer_key and consumer_secret.

Once you have those you then run the get_access_token.py script to generate
the rest of the data.

Yea, Twitter and oAuth are complicated, heck it took me almost a week to
get python-twitter to work with the python oauth lib, but it does work.

I have been correcting the odd doc locations that I wasn't aware of as I
find (or am told about them) - so if you find some let me know.

python-...@googlecode.com

unread,
Nov 5, 2010, 3:09:58 PM11/5/10
to python-twi...@googlegroups.com

Comment #11 on issue 161 by dom747: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

I didn't say it doesn't support it. I was just asking when there will be a
new release. I didn't know how to use trunk or oauth-twitter or
python-oauth2.
The example tweet.py with the latest package of python-twitter is wrong. I
guess it is because 0.6 is from July 2009.

python-...@googlecode.com

unread,
Nov 5, 2010, 4:05:00 PM11/5/10
to python-twi...@googlegroups.com

Comment #12 on issue 161 by bear42: HTTP Error 401 every time.
http://code.google.com/p/python-twitter/issues/detail?id=161

ahh - then I need to apologize as I thought you were using the trunk source.

yes, getting a release has been at the top of my mind, just need to find
some focus time.

again, sorry for jumping all over ya for the wrong thing! doh!

Reply all
Reply to author
Forward
0 new messages