question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing Twitter keys error is confusing

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
edsucommented, Mar 3, 2017

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.

0reactions
remagiocommented, Mar 3, 2017

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

  • a valid –profile name (default not works)
  • ENVs Twitter api keys

It says “TypeError: string indices must be integers” instead of something like “twitter api key or .twarc missing”.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found