Skip to content

Instantly share code, notes, and snippets.

@mIcHyAmRaNe
Created May 1, 2019 22:52
Show Gist options
  • Save mIcHyAmRaNe/046be9f1fa91edd68d4aa41acec83eaa to your computer and use it in GitHub Desktop.
Save mIcHyAmRaNe/046be9f1fa91edd68d4aa41acec83eaa to your computer and use it in GitHub Desktop.
get random proxy from proxy-list.download
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import random
rq = requests.get('http://www.proxy-list.download/api/v1/get?type=http&anon=elite').text.splitlines()
prox = random.choice(rq)
proxies = {
'http': 'http://'+prox,
'https': 'http://'+prox,
}
print(prox)
try:
print(' └─────►',requests.get('http://ip.42.pl/raw', proxies=proxies, timeout=15).text)
except (ConnectionError, HTTPError, Timeout):
print ('\n [x] Server not responding')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment