Skip to content

Commit

Permalink
Fixed potential IndexError
Browse files Browse the repository at this point in the history
  • Loading branch information
simao-silva authored Jun 29, 2022
1 parent 7a81f0b commit 3fc14a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion renew.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_user_agent():
r = requests.get(url="https://jnrbsn.github.io/user-agents/user-agents.json")
if r.status_code == 200 and len(list(r.json())) > 0:
agents = r.json()
return list(agents).pop(random.randint(0, len(agents)))
return list(agents).pop(random.randint(0, len(agents) - 1))
else:
return "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36"

Expand Down

0 comments on commit 3fc14a6

Please sign in to comment.