Getting OAuth error when using updateStatusWithMedia (Fixed) #122

Closed
opened 2012-10-15 15:06:57 -07:00 by genghisu · 19 comments
genghisu commented 2012-10-15 15:06:57 -07:00 (Migrated from github.com)

I get the following error when using updateStatusWithMedia:

{"request":"/1/statuses/update_with_media.json","error":"Could not authenticate with OAuth."}

The updateStatus endpoint works fine, but updateStatusWithMedia generates an OAuth exception.

I get the following error when using updateStatusWithMedia: {"request":"\/1\/statuses\/update_with_media.json","error":"Could not authenticate with OAuth."} The updateStatus endpoint works fine, but updateStatusWithMedia generates an OAuth exception.
michaelhelmick commented 2012-10-15 15:30:18 -07:00 (Migrated from github.com)

What version of requests are you using?

Sent from my iPhone

On Oct 15, 2012, at 6:06 PM, genghisu notifications@github.com wrote:

I get the following error when using updateStatusWithMedia:

{"request":"/1/statuses/update_with_media.json","error":"Could not authenticate with OAuth."}

The updateStatus endpoint works fine, but updateStatusWithMedia generates an OAuth exception.


Reply to this email directly or view it on GitHub.

What version of requests are you using? Sent from my iPhone On Oct 15, 2012, at 6:06 PM, genghisu notifications@github.com wrote: > I get the following error when using updateStatusWithMedia: > > {"request":"\/1\/statuses\/update_with_media.json","error":"Could not authenticate with OAuth."} > > The updateStatus endpoint works fine, but updateStatusWithMedia generates an OAuth exception. > > — > Reply to this email directly or view it on GitHub.
michaelhelmick commented 2012-10-15 15:30:28 -07:00 (Migrated from github.com)

And what version of Twython as well?

Sent from my iPhone

On Oct 15, 2012, at 6:06 PM, genghisu notifications@github.com wrote:

I get the following error when using updateStatusWithMedia:

{"request":"/1/statuses/update_with_media.json","error":"Could not authenticate with OAuth."}

The updateStatus endpoint works fine, but updateStatusWithMedia generates an OAuth exception.


Reply to this email directly or view it on GitHub.

And what version of Twython as well? Sent from my iPhone On Oct 15, 2012, at 6:06 PM, genghisu notifications@github.com wrote: > I get the following error when using updateStatusWithMedia: > > {"request":"\/1\/statuses\/update_with_media.json","error":"Could not authenticate with OAuth."} > > The updateStatus endpoint works fine, but updateStatusWithMedia generates an OAuth exception. > > — > Reply to this email directly or view it on GitHub.
genghisu commented 2012-10-15 15:37:51 -07:00 (Migrated from github.com)

requests - 0.14.1
Twython - 2.4.0 (git cloned on 10/15/2012)

requests - 0.14.1 Twython - 2.4.0 (git cloned on 10/15/2012)
michaelhelmick commented 2012-10-15 16:04:34 -07:00 (Migrated from github.com)

Try cloning from my 2.5.0 branch (https://github.com/michaelhelmick/twython/zipball/2.4.0)

I know it says 2.4.0 cause I'm a dummy and messed up haha
But clone mine, and let me know if it works there! :)

Try cloning from my 2.5.0 branch (https://github.com/michaelhelmick/twython/zipball/2.4.0) I know it says 2.4.0 cause I'm a dummy and messed up haha But clone mine, and let me know if it works there! :)
marks7g commented 2012-10-16 12:24:53 -07:00 (Migrated from github.com)

Have the same problem. updateStatusWithMedia gives OAuth error below. updateStatus and updateProfileImage work fine.

TwythonError: u'Unauthorized: Authentication credentials were missing or incorrect. -- Could not authenticate with OAuth.'

I have seen the other threads regarding issue with requests but I have latest version.

requests==0.14.1
simplejson==2.6.2
twython==2.4.0


In [14]: twitter.updateStatusWithMedia('/home/pi/snap.jpg', status='never works. igrnore')
---------------------------------------------------------------------------
TwythonError                              Traceback (most recent call last)
/usr/lib/python2.7/dist-packages/django/core/management/commands/shell.py in <module>()
----> 1 twitter.updateStatusWithMedia('/home/pi/snap.jpg', status='never works. igrnore')

/usr/local/lib/python2.7/dist-packages/twython/twython.pyc in updateStatusWithMedia(self, file_, version, **params)
    452         return self._media_update(url,
    453                                   {'media': (file_, open(file_, 'rb'))},
--> 454                                   **params)
    455 
    456     def _media_update(self, url, file_, **params):

/usr/local/lib/python2.7/dist-packages/twython/twython.pyc in _media_update(self, url, file_, **params)
    455 
    456     def _media_update(self, url, file_, **params):
--> 457         return self.post(url, params=params, files=file_)
    458 
    459     def getProfileImageUrl(self, username, size='normal', version=1):

/usr/local/lib/python2.7/dist-packages/twython/twython.pyc in post(self, endpoint, params, files, version)
    240 
    241     def post(self, endpoint, params=None, files=None, version=1):
--> 242         return self.request(endpoint, 'POST', params=params, files=files, version=version)
    243 
    244     # End Dynamic Request Methods

/usr/local/lib/python2.7/dist-packages/twython/twython.pyc in request(self, endpoint, method, params, files, version)
    232             url = '%s/%s.json' % (self.api_url % version, endpoint)
    233 
--> 234         content = self._request(url, method=method, params=params, files=files, api_call=url)
    235 
    236         return content

/usr/local/lib/python2.7/dist-packages/twython/twython.pyc in _request(self, url, method, params, files, api_call)
    209             raise exceptionType(error_msg,
    210                                 error_code=response.status_code,
--> 211                                 retry_after=response.headers.get('retry-after'))
    212 
    213         # if we have a json error here , then it's not an official TwitterAPI error

TwythonError: u'Unauthorized: Authentication credentials were missing or incorrect. -- Could not authenticate with OAuth.'


Have the same problem. updateStatusWithMedia gives OAuth error below. updateStatus and updateProfileImage work fine. TwythonError: u'Unauthorized: Authentication credentials were missing or incorrect. -- Could not authenticate with OAuth.' I have seen the other threads regarding issue with requests but I have latest version. requests==0.14.1 simplejson==2.6.2 twython==2.4.0 ``` python In [14]: twitter.updateStatusWithMedia('/home/pi/snap.jpg', status='never works. igrnore') --------------------------------------------------------------------------- TwythonError Traceback (most recent call last) /usr/lib/python2.7/dist-packages/django/core/management/commands/shell.py in <module>() ----> 1 twitter.updateStatusWithMedia('/home/pi/snap.jpg', status='never works. igrnore') /usr/local/lib/python2.7/dist-packages/twython/twython.pyc in updateStatusWithMedia(self, file_, version, **params) 452 return self._media_update(url, 453 {'media': (file_, open(file_, 'rb'))}, --> 454 **params) 455 456 def _media_update(self, url, file_, **params): /usr/local/lib/python2.7/dist-packages/twython/twython.pyc in _media_update(self, url, file_, **params) 455 456 def _media_update(self, url, file_, **params): --> 457 return self.post(url, params=params, files=file_) 458 459 def getProfileImageUrl(self, username, size='normal', version=1): /usr/local/lib/python2.7/dist-packages/twython/twython.pyc in post(self, endpoint, params, files, version) 240 241 def post(self, endpoint, params=None, files=None, version=1): --> 242 return self.request(endpoint, 'POST', params=params, files=files, version=version) 243 244 # End Dynamic Request Methods /usr/local/lib/python2.7/dist-packages/twython/twython.pyc in request(self, endpoint, method, params, files, version) 232 url = '%s/%s.json' % (self.api_url % version, endpoint) 233 --> 234 content = self._request(url, method=method, params=params, files=files, api_call=url) 235 236 return content /usr/local/lib/python2.7/dist-packages/twython/twython.pyc in _request(self, url, method, params, files, api_call) 209 raise exceptionType(error_msg, 210 error_code=response.status_code, --> 211 retry_after=response.headers.get('retry-after')) 212 213 # if we have a json error here , then it's not an official TwitterAPI error TwythonError: u'Unauthorized: Authentication credentials were missing or incorrect. -- Could not authenticate with OAuth.' ```
michaelhelmick commented 2012-10-16 12:26:20 -07:00 (Migrated from github.com)

@marks7g Like I asked @genghisu

Try cloning from my 2.5.0 branch (https://github.com/michaelhelmick/twython/zipball/2.4.0)
I know it says 2.4.0 cause I'm a dummy and messed up haha
But clone mine, and let me know if it works there! :)

@marks7g Like I asked @genghisu > Try cloning from my 2.5.0 branch (https://github.com/michaelhelmick/twython/zipball/2.4.0) > I know it says 2.4.0 cause I'm a dummy and messed up haha > But clone mine, and let me know if it works there! :)
marks7g commented 2012-10-16 12:50:50 -07:00 (Migrated from github.com)

Have done. Still the same. Anything else I can check?

Also maybe a stupid question but how can I be sure I am running your 2.5.0 branch?

Have done. Still the same. Anything else I can check? Also maybe a stupid question but how can I be sure I am running your 2.5.0 branch?
michaelhelmick commented 2012-10-16 12:59:00 -07:00 (Migrated from github.com)

After you pull a clone. Go into the directory and then run python and execute:

from twython import Twython
twython.version

Sent from my iPhone

On Oct 16, 2012, at 3:50 PM, marks7g notifications@github.com wrote:

Have done. Still the same. Anything else I can check?

Also maybe a stupid question but how can I be sure I am running your 2.5.0 branch?


Reply to this email directly or view it on GitHub.

After you pull a clone. Go into the directory and then run python and execute: > from twython import Twython > twython.**version** Sent from my iPhone On Oct 16, 2012, at 3:50 PM, marks7g notifications@github.com wrote: > Have done. Still the same. Anything else I can check? > > Also maybe a stupid question but how can I be sure I am running your 2.5.0 branch? > > — > Reply to this email directly or view it on GitHub.
marks7g commented 2012-10-16 13:35:48 -07:00 (Migrated from github.com)

In [1]: from twython import twython

In [2]: twython.version
Out[2]: '2.4.0'

I removed the twython I had with

pip -uninstall twython

downloaded yours from link and ran

sudo python setup.py install

On Tue, Oct 16, 2012 at 8:59 PM, Mike Helmick notifications@github.comwrote:

After you pull a clone. Go into the directory and then run python and
execute:

from twython import Twython
twython.version

Sent from my iPhone

On Oct 16, 2012, at 3:50 PM, marks7g notifications@github.com wrote:

Have done. Still the same. Anything else I can check?

Also maybe a stupid question but how can I be sure I am running your
2.5.0 branch?


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com/ryanmcgrath/twython/issues/122#issuecomment-9504327.

In [1]: from twython import twython In [2]: twython.**version** Out[2]: '2.4.0' I removed the twython I had with > pip -uninstall twython downloaded yours from link and ran > sudo python setup.py install On Tue, Oct 16, 2012 at 8:59 PM, Mike Helmick notifications@github.comwrote: > After you pull a clone. Go into the directory and then run python and > execute: > > > from twython import Twython > > twython.**version** > > Sent from my iPhone > > On Oct 16, 2012, at 3:50 PM, marks7g notifications@github.com wrote: > > > Have done. Still the same. Anything else I can check? > > > > Also maybe a stupid question but how can I be sure I am running your > > 2.5.0 branch? > > > > — > > Reply to this email directly or view it on GitHub. > > — > Reply to this email directly or view it on GitHubhttps://github.com/ryanmcgrath/twython/issues/122#issuecomment-9504327.
michaelhelmick commented 2012-10-16 13:36:39 -07:00 (Migrated from github.com)

I'm testing now and it doesn't work with my release either. Working on a fix for this. Will let you know if I come up with anything.

I'm testing now and it doesn't work with my release either. Working on a fix for this. Will let you know if I come up with anything.
marks7g commented 2012-10-16 13:37:59 -07:00 (Migrated from github.com)

Thanks. Much appreciated.

On Tue, Oct 16, 2012 at 9:36 PM, Mike Helmick notifications@github.comwrote:

I'm testing now and it doesn't work with my release either. Working on a
fix for this. Will let you know if I come up with anything.


Reply to this email directly or view it on GitHubhttps://github.com/ryanmcgrath/twython/issues/122#issuecomment-9505663.

Thanks. Much appreciated. On Tue, Oct 16, 2012 at 9:36 PM, Mike Helmick notifications@github.comwrote: > I'm testing now and it doesn't work with my release either. Working on a > fix for this. Will let you know if I come up with anything. > > — > Reply to this email directly or view it on GitHubhttps://github.com/ryanmcgrath/twython/issues/122#issuecomment-9505663.
michaelhelmick commented 2012-10-16 13:48:59 -07:00 (Migrated from github.com)

It seems to be a problem with requests when sending the data and files kwargs. Hrm.

It seems to be a problem with `requests` when sending the `data` **and** `files` kwargs. Hrm.
davidmann4 commented 2012-10-27 17:09:16 -07:00 (Migrated from github.com)

I have the same problem - we once solved it with this hack: https://github.com/ryanmcgrath/twython/issues/113

but now i updated the lib and i have the same error again ..

I have the same problem - we once solved it with this hack: https://github.com/ryanmcgrath/twython/issues/113 but now i updated the lib and i have the same error again ..
danxshap commented 2012-10-29 11:15:29 -07:00 (Migrated from github.com)

@michaelhelmick have you been able to get updateStatusWithMedia working by any chance?

I'm using requests 0.14.1 and twython 2.4.0, both from pypi, and I'm having the same issue as everyone above.

I've tried several different things using requests directly, but haven't had any luck :-\

@michaelhelmick have you been able to get updateStatusWithMedia working by any chance? I'm using requests 0.14.1 and twython 2.4.0, both from pypi, and I'm having the same issue as everyone above. I've tried several different things using requests directly, but haven't had any luck :-\
michaelhelmick commented 2012-10-29 11:25:25 -07:00 (Migrated from github.com)

@danxshap Try downgrading to requests 0.14.0

pip install -I requests==0.14.0

That worked for me.

@danxshap Try downgrading to `requests` 0.14.0 `pip install -I requests==0.14.0` That worked for me.
danxshap commented 2012-10-29 11:39:19 -07:00 (Migrated from github.com)

@michaelhelmick totally works - you're the man! just curious, any idea what the problem is in 0.14.1?

@michaelhelmick totally works - you're the man! just curious, any idea what the problem is in 0.14.1?
michaelhelmick commented 2012-10-29 11:41:32 -07:00 (Migrated from github.com)

Not sure, the issue is in 0.14.2 as well.

I opened an issue here: https://github.com/kennethreitz/requests/issues/896

But nobody has responded yet.

Not sure, the issue is in 0.14.2 as well. I opened an issue here: https://github.com/kennethreitz/requests/issues/896 But nobody has responded yet.
davidmann4 commented 2012-10-29 16:31:56 -07:00 (Migrated from github.com)

used the

pip install -I requests==0.14.0

command and now it works ! thx thx

used the pip install -I requests==0.14.0 command and now it works ! thx thx
ryanmcgrath commented 2012-11-09 01:40:11 -08:00 (Migrated from github.com)

Well, @michaelhelmick knocked this out of the park, so we can go ahead and close this now.

Well, @michaelhelmick knocked this out of the park, so we can go ahead and close this now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/twython#122
No description provided.