401 error after uploading several images
jackwakefield opened this issue · 8 comments
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.
Hi,
Apparently you have a python script that succesfully posts pics.
Mine does not I am afraid. Would you be willing to share the working code
please?
That would make me very happy!
I have been troubleshooting 2 weeks but no working script yet.
HansCees at HansCees dot com
Op 22 aug. 2013 11:38 schreef "xadet" notifications@github.com het
volgende:
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
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: UnauthorizedI'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.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/7
.
As for Your question I would try to do a sleep 20 after every post?
Op 22 aug. 2013 11:38 schreef "xadet" notifications@github.com het
volgende:
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
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: UnauthorizedI'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.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/7
.
I initially had an issue because Twitter deprecated their API 1 in favour of API 1.1. Although the pull request #5 had been merged pip install python-twitpic
didn't seem to work so I used pip install git+https://github.com/macmichael01/python-twitpic.git
which did.
Ok. But could I still use your code please?
I am a bash and perl scripter, and python is really beyond me....
Hc
Verstuurd vanaf mijn iPad
Op 22 aug. 2013 om 14:38 heeft xadet notifications@github.com het volgende geschreven:
I initially had an issue because Twitter deprecated their API 1 in favour of API 1.1. Although the pull request #5 had been merged pip install python-twitpic didn't seem to work so I used pip install git+https://github.com/macmichael01/python-twitpic.git which did.
—
Reply to this email directly or view it on GitHub.
It's essentially
twitpic = TwitPicOAuthClient(
consumer_key = '',
consumer_secret = '',
access_token = '',
service_key = ''
)
response = twitpic.create('upload', {
'media': '/file/path,
'message': ''
})
print(response['url'])
The sleep
didn't work unfortunately.
Do you do something like
For 1-10 upload.py
So for every upload you call the script and thus log in with the api?
Or can you do
Login
Upload 1, upload 2, upload 3
Logout
I think it is the for 1-10 way right?
Perhaps try
Upload 5 pics,
Sleep 3 minutes
Upload 5 again.
And then see if sleep 10 minutes works or 5 etc?
Verstuurd vanaf mijn iPad
Op 22 aug. 2013 om 14:50 heeft xadet notifications@github.com het volgende geschreven:
The sleep didn't work unfortunately.
—
Reply to this email directly or view it on GitHub.
There was a recent update to API V1.1 though I haven't had the chance to upload the new python package but will try to do so tonight.
401s are usually a result of an invalid twitter oauth_token.
As for the the massive image uploading issue, sound like server throttling. I'd recommend using python threading and sleep for x amount of time as was mentioned above.
If you have python specific questions I would recommend directing such questions to a python users group since this section is used specifically for filing bugs.
Cheers!