Spaces:
Sleeping
Sleeping
File size: 631 Bytes
29608dd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import requests
import random
PROXY_URL = 'https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/json/proxies.json'
# Fetch the list of proxies
def getProxy():
response = requests.get(PROXY_URL, timeout=5)
# Check if the request was successful
if response.status_code == 200:
proxies = (response.json())["https"]
# Select a random list of 5 from the list
random_proxylist = random.sample(proxies, 10)
# Print the selected proxy
return random_proxylist
else:
print(f"Error {response.status_code}: Could not retrieve proxy list.")
getProxy()
|