Missing Twitter keys error is confusing
See original GitHub issueI’m having issues in using replies and --recursive, --recursive result is a mismatch argument. Just a sample without using the recursive argument (same with any ID):
twarc replies 833504567644024832 --log test.log
result:
errors
Traceback (most recent call last):
File "/usr/local/bin/twarc", line 4, in <module>
__import__('pkg_resources').run_script('twarc==1.0.6', 'twarc')
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 738, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1506, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/twarc-1.0.6-py2.7.egg/EGG-INFO/scripts/twarc", line 4, in <module>
__import__('pkg_resources').run_script('twarc==1.0.6', 'twarc')
File "build/bdist.linux-x86_64/egg/twarc.py", line 194, in main
for thing in things:
File "build/bdist.linux-x86_64/egg/twarc.py", line 795, in replies
screen_name = tweet['user']['screen_name']
TypeError: string indices must be integers
The test.log lists an “hydrate” then an “archived errors” instead replies:
2017-03-01 16:37:25,261 INFO loading config /root/.twarc
2017-03-01 16:37:25,262 INFO creating http session
2017-03-01 16:37:25,262 INFO hydrating ['833504567644024832']
2017-03-01 16:37:25,406 INFO archived errors
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Twitter API Response Codes & Error Support - Twitter Developer
Get Twitter API response codes and error support through Twitter Developer here. ... This could be due to missing or incorrect authentication credentials....
Read more >Authentication - Regenerate API keys and tokens
If your keys are compromised, bad actors could use them to make requests to the Twitter endpoints on behalf of your developer App...
Read more >Getting access to the Twitter API | Docs
If you misplace or forget the keys and tokens, you will need to regenerate them, which creates new credentials and invalidates the old...
Read more >API Key and Secret | Docs | Twitter Developer Platform
Open the App which is associated with the API Key and Secret that you would like to find or regenerate; Navigate to the...
Read more >Authorizing a request | Docs | Twitter Developer Platform
The purpose of this document is to show you how to modify HTTP requests for the purpose of sending authorized requests to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ahah! this is something that has bitten me too. You’re right there should be a much better error message when no keys are found.
Hi @edsu, I did some more tests and I found the source of the issue. Despite the presence of a populated .twarc with working profiles, and previous twarc’s jobs were still running fine, I started some new twarcs with replies getting: “TypeError: string indices must be integers” using <twarc replies ‘833504567644024832’>".
TypeError confused me thinking it was related with “replies” but it’s related with Twitter Keys & config arguments. Despite previous releases -p argument stopped to work and default key profile too. Since last twarc updates (both VMs via pip or via github) it works only if settings ENVs Twitter Key or using –profile instead -p. I missed twarc deprecated -p vs --profile (!?).
So the real issue is "if using <twarc replies ‘833504567644024832’> without
It says “TypeError: string indices must be integers” instead of something like “twitter api key or .twarc missing”.