fixed exception when no hashtag is present
This commit is contained in:
parent
0ba324a373
commit
ce92f432e2
@ -51,9 +51,14 @@ class twitter:
|
|||||||
|
|
||||||
r = requests.get(url=get_url, headers=header)
|
r = requests.get(url=get_url, headers=header)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
try:
|
||||||
excluded = r.json()[0]['entities']['hashtags'][0]['text']
|
excluded = r.json()[0]['entities']['hashtags'][0]['text']
|
||||||
if excluded in self.credentials['exclude']:
|
if excluded in self.credentials['exclude']:
|
||||||
exit(0)
|
exit(0)
|
||||||
|
except IndexError:
|
||||||
|
# No hashtags, that's fine
|
||||||
|
pass
|
||||||
|
|
||||||
return r.json()[0]
|
return r.json()[0]
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user