Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle "User not found" error #37

Closed
simonw opened this issue Mar 20, 2020 · 3 comments
Closed

Handle "User not found" error #37

simonw opened this issue Mar 20, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@simonw
Copy link
Collaborator

simonw commented Mar 20, 2020

While running user-timeline I got this bug (because a screen name I asked for didn't exist):

  File "/Users/simonw/Dropbox/Development/twitter-to-sqlite/twitter_to_sqlite/utils.py", line 185, in transform_user
    user["created_at"] = parser.parse(user["created_at"])
KeyError: 'created_at'
>>> import pdb
>>> pdb.pm()
> /Users/simonw/Dropbox/Development/twitter-to-sqlite/twitter_to_sqlite/utils.py(185)transform_user()
-> user["created_at"] = parser.parse(user["created_at"])
(Pdb) user
{'errors': [{'code': 50, 'message': 'User not found.'}]}
@simonw simonw added the bug Something isn't working label Mar 20, 2020
@simonw
Copy link
Collaborator Author

simonw commented Apr 17, 2020

$ twitter-to-sqlite user-timeline doggo.db doggoenthuonetuh
Traceback (most recent call last):
...
  File "/Users/simonw/Dropbox/Development/twitter-to-sqlite/twitter_to_sqlite/utils.py", line 272, in transform_user
    user["created_at"] = parser.parse(user["created_at"])
KeyError: 'created_at'

@simonw
Copy link
Collaborator Author

simonw commented Apr 17, 2020

I'm going to print a warning to stderr, skip and continue - because if you have 100 screen names and only one of them is invalid you should still execute for the other 99.

@simonw
Copy link
Collaborator Author

simonw commented Apr 17, 2020

That's a bit tricky since I'd have to rewrite the internals of a bunch of other commands. For the moment I'll exit the script with an error but at least it will be a decent error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant