Spaces:
Paused
Paused
Download proxy.py from andronasef/googleit-server: direct link, hf CLI and curl.
- Browser
- Download file 631 Bytes
-
https://huggingface.co/spaces/andronasef/googleit-server/resolve/main/proxy.py
- Command line
-
hf download hf://spaces/andronasef/googleit-server/proxy.py
-
curl -L -o proxy.py https://huggingface.co/spaces/andronasef/googleit-server/resolve/main/proxy.py
631 Bytes
| 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() | |