Handle a numeric user_id passed to timeline
@@ -114,7 +114,7 @@ class Twarc(object):
# Strip if screen_name is prefixed with '@'
if screen_name:
screen_name = screen_name.lstrip('@')
- id = screen_name or user_id
+ id = screen_name or str(user_id)
id_type = "screen_name" if screen_name else "user_id"
logging.info("starting user timeline for user %s", id)
url = "https://api.twitter.com/1.1/statuses/user_timeline.json"
@@ -143,7 +143,7 @@ class Twarc(object):
for status in statuses:
# If you request an invalid user_id, you may still get
# results so need to check.
- if not user_id or user_id == status.get("user",
+ if not user_id or id == status.get("user",
{}).get("id_str"):
yield status
