python-twitpic icon indicating copy to clipboard operation
python-twitpic copied to clipboard

post does not work

Open hanscees opened this issue 12 years ago • 3 comments

Hi,

been trying to use the script to upload but to no avail.

is this right?

twitpic -m bomengids yUAOXeDFyw T7hDjQQ oauth_token=324319099-WiJyNkshqfgKahdcH0IBSCTVhYOVxzXxfBvsVyVd&oauth_token_secret=gSmkBDUAHKzY=%s bb7c3defd60 /root/pics/1.jpg

I have tried oauth_token=3243yVd&oauth_token_secret=gSmzY oauth_token=3243yVd&oauth_token_secret=gSmzY=%s oauth_token=3243yVd=%20&oauth_token_secret=gSmzY=%s oauth_token=3243yVd=%20&oauth_token_secret=gSmzY=%s oauth_token=3243yVd&oauth_token_secret=gSmzY=%s

all respons I get is: HTTP/1.1 401 Unauthorized Server: nginx Date: Tue, 20 Aug 2013 20:40:23 GMT Content-Type: application/json Transfer-Encoding: chunked Connection: close X-Powered-By: PHP/5.3.5-1ubuntu7.2 5e {"errors":[{"code":401,"message":"Could not authenticate you (header rejected by twitter)."}]} 0

I am sure my twitter secrets etc are right because they work using this perl script: http://hanscees-howto.blogspot.nl/2013/08/hacking-twitter-send-tweets-with-simple.html

hanscees avatar Aug 20 '13 21:08 hanscees

it would be nice for people using your code if you would include a standard script that actually has been verified by you to work. This way non-coders can know if there is actually a bug. And you won't have to be bugged with code questions:-)

hanscees avatar Aug 22 '13 19:08 hanscees

I also verified now that posting to twitpic works from a python script, but using twitpic commandline does not work.

The working code is (using python 2.7):

################################# #!/usr/bin/python import twitpic

twitpic = twitpic.TwitPicOAuthClient( consumer_key = 'yU..........AOFyw', consumer_secret = 'T7hxxJMTjQQ', access_token = 'oauth_token=3299-WiJV...........yVd&oauth_token_secret=gS........mkDUAHKzY', service_key = 'bb7c36d5cefd60' )

response = twitpic.create('upload', { 'media': '/root/pics/1.jpg', 'message': 'test pic posted with python' })

print(response['url']) #################

It would be nice by the way if you could publish a script that also directly posts a tweet on twitter with a text and the resulting twitpic url

hanscees avatar Aug 23 '13 06:08 hanscees

It would be nice by the way if you could publish a script that also directly posts a tweet on twitter with a text and the resulting twitpic url

The goal of this library interact strictly with twitpic's API. If you need to publish this to your twitter feed, the twitter library that you used to get your access token will also have a method to publish to your feed.

As for the commandline tool, I'd have to take a look, though my time is limited at the moment.

macmichael01 avatar Aug 23 '13 16:08 macmichael01