Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import secrets
- def random_values(d_lists):
- """
- Returns a random value from a list.
- Args
- """
- idx = secrets.randbelow(len(d_lists))
- return d_lists[idx]
- def userAgents():
- """
- Returns a random user agent string from a file containing a list of user agents.
- Args:
- -None
- Returns:
- -A string representing a ranom user agent.
- """
- with open('user-agents.txt') as f:
- agents = f.read().split("\n")
- return random_values(agents)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement