Closed onozka closed 12 years ago
In reviewing the REST documentation, the APIs for getting friends and followers hasn't changed, and this code has been pretty widely used, so I think there may just be a problem in the way that you are building up the request. In looking at the error you pasted in, I see a url key/value pair of screen_name=friends_followers__get_friends_refactored.py, which shouldn't be the case. It should actually be something like screen_name=onozka
In looking at how you have invoked the script ($ python friends_followersget_friends_refactored.py ), it looks like you may just need to invoke it differently? Give it a whirl, and let me know what happens.
Thank you for replying! I did not comprehend what sys.argv[1] means... Now I know it requires argument :D Then I invoked ($ python friends_followersget_friends_refactored.py onozka), it works correctly!! Wow! Thank you!!
Awesome! Glad it's working for you.
Hi. twitterutil.py does not work on example 4-3. I'm using latest version of twitterutil.py on GitHub.
I wrote blow is error message. It occurs 404 error.
xxxxxxx-MacBook-Air:~ onozka$ python friends_followersget_friends_refactored.py Traceback (most recent call last): File "friends_followersget_friends_refactored.py", line 37, in
ids = getFriendIds(sys.argv[0], friends_limit=10000)
File "friends_followers get_friends_refactored.py", line 26, in getFriendIds
response = makeTwitterRequest(t, t.friends.ids, **params)
File "/Users/pamsuke/twitterutil.py", line 21, in makeTwitterRequest
wait_period = handleTwitterHTTPError(e, t, wait_period)
File "/Users/pamsuke/twitterutil.py", line 61, in handleTwitterHTTPError
raise e
twitter.api.TwitterHTTPError: Twitter sent status 404 for URL: 1/friends/ids.json using parameters: (cursor=-1&oauth_consumer_key=xxxxxxxx&oauth_nonce=xxxxxxxxx&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1325677562&oauth_token=xxxxxxx&oauth_version=1.0&screen_name=friends_followers__get_friends_refactored.py&oauth_signature=xxxxxxxxxxxx)
details: {"error":"Not found","request":"\/1\/friends\/ids.json?cursor=-1&oauth_consumer_key=xxxxxxxxx&oauth_nonce=xxxxxxxxxx&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1325677562&oauth_token=xxxxxxxxxx&oauth_version=1.0&screen_name=friends_followersget_friends_refactored.py&oauth_signature=xxxxxxxxxx"}
Same error occurs in any other examples which imports twitter__util.py.
How to fix twitter__util.py? X(