macmichael01 / python-twitpic

The python TwitPic Client API library
28 stars 3 forks source link

KeyError: oauth_token #4

Closed danielholm closed 12 years ago

danielholm commented 12 years ago

Trying to use the 2.0 script and tweet an image. I've registred for all the necessary keys at both Twitter and TwitPic, but I get this when I attempt to run the scipt:

Traceback (most recent call last): File "/home/daniel/.sharecenter/plugins/twitpic/twitpic2.py", line 446, in service_key = opts.service_key, File "/home/daniel/.sharecenter/plugins/twitpic/twitpic2.py", line 139, in init self.access_token = oauth.OAuthToken.from_string(access_token) File "/usr/lib/python2.7/dist-packages/oauth/oauth.py", line 142, in from_string key = params['oauth_token'][0] KeyError: 'oauth_token'

Saberre commented 12 years ago

Did you correctly assigned access_token value? access_token value should be in type of oauth_token=%s&oauth_token_secret=%s

danielholm commented 12 years ago

I used the command line version.

Saberre commented 12 years ago

I mean, was your access_token value in the form of oauth_token=(Your OAuth Access Token)&oauth_token_secret=(Your OAuth Access Token Secret)?

Please check your oauth_token. You have to escape the ampersand character if you run in command line.

danielholm commented 12 years ago

Ah, ok. I just copied the command from the README and replaced the argument variables to the keys that I have: twitpic2.py -k CONSUMER_KEY -s CONSUMER_SECRET -a ACCESS_TOKEN -t SERVICE_KEY -m TWEET -f FILE twitpic2.py -k fgsgfjh4r34-s abcvdsfh12323 -a fdsdfsarg34534534 -t 234234sgsdgdfg -m Messgae -f file.jpg

Saberre commented 12 years ago

oh... so your ACCESS_TOKEN is not in the form of oauth_token=(Your OAuth Access Token)&oauth_token_secret=(Your OAuth Access Token Secret). You should make it like this: oauth_token=fdsdfsarg34534534&oauth_token_secret=accesstokensecret12345

macmichael01 commented 12 years ago

Saberre is correct, based on the error you are getting, it is likely that you have a malformed ACCESS_TOKEN and should be in the form that he described. On another note, I made recent changes to this library. There is now a bash auto-complete script to upload photos with.

danielholm commented 12 years ago

Thank you, I'll take a look.