macmichael01 / python-twitpic Goto Github PK
View Code? Open in Web Editor NEWThe python TwitPic Client API library
The python TwitPic Client API library
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
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'
I feel like I'm doing everything right, but for some reason I can't get authorization from TwitPic.
Here's the relevant code:
twitpic = twitpic2.TwitPicOAuthClient(
consumer_key = settings.CONSUMER_KEY,
consumer_secret = settings.CONSUMER_SECRET,
access_token = "oauth_token=%s&oauth_token_secret=%s" % ( o_token, o_secret ),
service_key = settings.TWITPIC_API_KEY
)
twitpic.create("upload", { 'message': "Test Message", 'media': file })
The values for "o_token" and "o_secret" are being pulled from my twitter request_token session variables.
Here are the headers according to the Django debugger:
{'Content-Type': 'multipart/form-data; boundary=-------tHISiStheMulTIFoRMbOUNDaRY',
'User-Agent': 'Python-TwitPic2',
'X-Auth-Service-Provider': 'https://api.twitter.com/1/account/verify_credentials.json',
'X-Verify-Credentials-Authorization': 'OAuth realm="http://api.twitter.com/", oauth_nonce="94550488", oauth_timestamp="1309638145", oauth_consumer_key="Z2oDH0LJb9TNQy4cCKZgQ", oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_token="xM2zXj05RDiH71UATxRXTW5KXshgUS38BYNmoWZIQEI", oauth_signature="Di89Qtb48hrMR5FkOYGrRyxEnAM%3D"'}
And here's the error:
HTTP Error 401: Unauthorized
Please Help!
For the past two days I've been attempting to upload several hundred images using the library. After around 10-20 images (it never seems to be an exact number), I receive a 401 error.
Uploading gen/17.08.13/liverpool-vs-stoke-white.jpg
Uploading gen/17.08.13/liverpool-vs-stoke-green.jpg
Uploading gen/17.08.13/arsenal-vs-aston-villa-white.jpg
Uploading gen/17.08.13/arsenal-vs-aston-villa-green.jpg
Uploading gen/17.08.13/norwich-vs-everton-white.jpg
Uploading gen/17.08.13/norwich-vs-everton-green.jpg
Uploading gen/17.08.13/sunderland-vs-fulham-white.jpg
Uploading gen/17.08.13/sunderland-vs-fulham-green.jpg
Uploading gen/17.08.13/west-brom-vs-southampton-white.jpg
Uploading gen/17.08.13/west-brom-vs-southampton-green.jpg
Uploading gen/17.08.13/west-ham-vs-cardiff-white.jpg
Uploading gen/17.08.13/west-ham-vs-cardiff-green.jpg
Uploading gen/17.08.13/swansea-vs-man-utd-white.jpg
Uploading gen/17.08.13/swansea-vs-man-utd-green.jpg
Uploading gen/18.08.13/crystal-palace-vs-tottenham-white.jpg
Uploading gen/18.08.13/crystal-palace-vs-tottenham-green.jpg
Traceback (most recent call last):
File "fixture-generator/upload-images.py", line 58, in <module>
main()
File "fixture-generator/upload-images.py", line 50, in main
'green': upload_image(fixture, green_path)
File "fixture-generator/upload-images.py", line 27, in upload_image
' l Support your team at http://www.SoccerHubb.com/ #GameOn'
File "/home/xadet/.virtualenvs/soccerhubb-fixture-generator/lib/python2.7/site-packages/twitpic/twitpic2.py", line 338, in create
return self._post_call(method, params, uri, required)
File "/home/xadet/.virtualenvs/soccerhubb-fixture-generator/lib/python2.7/site-packages/twitpic/twitpic2.py", line 250, in _post_call
raise TwitPicError(e)
twitpic.twitpic2.TwitPicError: HTTP Error 401: Unauthorized
I'm unsure whether this is an error with TwitPic or the library itself. I've attempted to contact TwitPic on Twitter but haven't had any luck.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.