ipsurv.requester package¶
Submodules¶
ipsurv.requester.dns_resolver module¶
ipsurv.requester.http module¶
ipsurv.requester.ip_info module¶
- class IpInfoRequester(timeout=None, token=None)¶
Bases:
ipsurv.requester.requester.Requester
- request(ip)¶
- request_ip(ip)¶
- set_headers(headers)¶
ipsurv.requester.rdap module¶
- class CountryDetector¶
Bases:
object
- COUNTRIES = {'afghanistan': 'AF', 'albania': 'AL', 'algeria': 'DZ', 'angola': 'AO', 'argentina': 'AR', 'armenia': 'AM', 'australia': 'AU', 'austria': 'AT', 'azerbaijan': 'AZ', 'bahrain': 'BH', 'bangladesh': 'BD', 'belarus': 'BY', 'belgium': 'BE', 'benin': 'BJ', 'bhutan': 'BT', 'bolivia': 'BO', 'bosnia and herzegovina': 'BA', 'botswana': 'BW', 'brazil': 'BR', 'bulgaria': 'BG', 'burkina faso': 'BF', 'burundi': 'BI', 'cambodia': 'KH', 'cameroon': 'CM', 'canada': 'CA', 'chad': 'TD', 'chile': 'CL', 'china': 'CN', 'colombia': 'CO', 'congo': 'CG', 'costa rica': 'CR', 'croatia': 'HR', 'cuba': 'CU', 'cyprus': 'CY', 'czech': 'CZ', "côte d'ivoire": 'CI', 'denmark': 'DK', 'djibouti': 'DJ', 'dominica': 'DM', 'ecuador': 'EC', 'egypt': 'EG', 'el salvador': 'SV', 'england': 'GB', 'equatorial guinea': 'GQ', 'eritrea': 'ER', 'estonia': 'EE', 'ethiopia': 'ET', 'fiji': 'FJ', 'finland': 'FI', 'france': 'FR', 'gabon': 'GA', 'gambia': 'GM', 'georgia': 'GE', 'germany': 'DE', 'ghana': 'GH', 'great britain': 'GB', 'greece': 'GR', 'greenland': 'GL', 'guam': 'GU', 'guatemala': 'GT', 'guinea': 'GN', 'guinea-bissau': 'GW', 'guyana': 'GY', 'haiti': 'HT', 'honduras': 'HN', 'hong kong': 'HK', 'hungary': 'HU', 'iceland': 'IS', 'india': 'IN', 'indonesia': 'ID', 'iran': 'IR', 'iraq': 'IQ', 'ireland': 'IE', 'israel': 'IL', 'italy': 'IT', 'jamaica': 'JM', 'japan': 'JP', 'jordan': 'JO', 'kazakhstan': 'KZ', 'kenya': 'KE', 'korea': 'KR', 'kuwait': 'KW', 'kyrgyzstan': 'KG', 'latvia': 'LV', 'lebanon': 'LB', 'lesotho': 'LS', 'liberia': 'LR', 'libya': 'LY', 'lithuania': 'LT', 'macao': 'MO', 'madagascar': 'MG', 'malawi': 'MW', 'malaysia': 'MY', 'maldives': 'MV', 'mali': 'ML', 'malta': 'MT', 'mauritania': 'MR', 'mauritius': 'MU', 'mexico': 'MX', 'micronesia': 'FM', 'moldova': 'MD', 'monaco': 'MC', 'mongolia': 'MN', 'montenegro': 'ME', 'morocco': 'MA', 'mozambique': 'MZ', 'myanmar': 'MM', 'namibia': 'NA', 'nepal': 'NP', 'netherlands': 'NL', 'new zealand': 'NZ', 'nicaragua': 'NI', 'niger': 'NE', 'nigeria': 'NG', 'norway': 'NO', 'oman': 'OM', 'pakistan': 'PK', 'palestine': 'PS', 'panama': 'PA', 'papua new guinea': 'PG', 'paraguay': 'PY', 'peru': 'PE', 'philippines': 'PH', 'poland': 'PL', 'portugal': 'PT', 'pr china': 'CN', 'puerto rico': 'PR', 'qatar': 'QA', 'romania': 'RO', 'russia': 'RU', 'rwanda': 'RW', 'saudi arabia': 'SA', 'senegal': 'SN', 'serbia': 'RS', 'sierra leone': 'SL', 'singapore': 'SG', 'slovakia': 'SK', 'slovenia': 'SI', 'solomon islands': 'SB', 'somalia': 'SO', 'south africa': 'ZA', 'south korea': 'KR', 'south sudan': 'SS', 'spain': 'ES', 'sri lanka': 'LK', 'sudan': 'SD', 'swaziland': 'SZ', 'sweden': 'SE', 'swiss confederation': 'CH', 'switzerland': 'CH', 'syria': 'SY', 'taiwan': 'TW', 'tajikistan': 'TJ', 'tanzania': 'TZ', 'thailand': 'TH', 'togo': 'TG', 'tunisia': 'TN', 'turkey': 'TR', 'turkmenistan': 'TM', 'u.k': 'GB', 'u.s': 'US', 'u.s.a': 'US', 'uae': 'AE', 'uganda': 'UG', 'ukraine': 'UA', 'united arab emirates': 'AE', 'united kingdom': 'GB', 'united states': 'US', 'united states of america': 'US', 'uruguay': 'UY', 'usa': 'US', 'uzbekistan': 'UZ', 'venezuela': 'VE', 'viet nam': 'VN', 'yemen': 'YE', 'zambia': 'ZM', 'zimbabwe': 'ZW'}¶
- COUNTRIES_REGEX = {'BO': 'bolivia', 'CD': "(republic\\s+[\\w\\s',.-]{5,10}\\s+congo|congo[,\\s]+[\\w\\s',.-]{10,20}\\s+republic)", 'CF': 'central african', 'CN': "(republic\\s+[\\w\\s',.-]{2,5}\\s+china|china[,\\s]+[\\w\\s',.-]{2,5}\\s+republic)", 'CZ': 'czech', 'DO': 'dominican', 'FM': 'micronesia', 'HK': 'hksar', 'IR': 'iran', 'KP': "(democratic\\s+[\\w\\s',.-]{2,25}\\s+korea|korea[,\\s]+[\\w\\s',.-]{2,25}\\s+democratic)", 'KR': "(republic\\s+[\\w\\s',.-]{2,5}\\s+korea|korea[,\\s]+[\\w\\s',.-]{2,5}\\s+republic)", 'LA': "lao\\s+[\\w\\s',.-]{2,10}\\s+democratic", 'MD': 'moldova', 'PS': 'palestine', 'RU': '(russian|russia)', 'SY': 'syrian', 'TW': 'taiwan', 'TZ': 'tanzania', 'US': '(usa|united states)', 'VE': '(venezuela|bolivarian)'}¶
- detect_by_address(v)¶
- detect_by_country(word)¶
- class RdapRequester(country_detector, fill=True, timeout=None)¶
Bases:
ipsurv.requester.requester.Requester
- COLLATIONS = {1: 2, 2: 3, 5: 3, 14: 2, 25: 3, 27: 2, 31: 3, 36: 2, 37: 3, 39: 2, 41: 5, 42: 2, 43: 2, 46: 3, 49: 2, 51: 3, 58: 2, 59: 2, 60: 2, 61: 2, 62: 3, 77: 3, 78: 3, 79: 3, 80: 3, 81: 3, 82: 3, 83: 3, 84: 3, 85: 3, 86: 3, 87: 3, 88: 3, 89: 3, 90: 3, 91: 3, 92: 3, 93: 3, 94: 3, 95: 3, 101: 2, 102: 5, 103: 2, 105: 5, 106: 2, 109: 3, 110: 2, 111: 2, 112: 2, 113: 2, 114: 2, 115: 2, 116: 2, 117: 2, 118: 2, 119: 2, 120: 2, 121: 2, 122: 2, 123: 2, 124: 2, 125: 2, 126: 2, 133: 2, 141: 3, 145: 3, 150: 2, 151: 3, 153: 2, 154: 5, 163: 2, 171: 2, 175: 2, 176: 3, 177: 4, 178: 3, 179: 4, 180: 2, 181: 4, 182: 2, 183: 2, 185: 3, 186: 4, 187: 4, 188: 3, 189: 4, 190: 4, 191: 4, 193: 3, 194: 3, 195: 3, 196: 5, 197: 5, 200: 4, 201: 4, 202: 2, 203: 2, 210: 2, 211: 2, 212: 3, 213: 3, 217: 3, 218: 2, 219: 2, 220: 2, 221: 2, 222: 2, 223: 2}¶
- ID_AFRINIC = 5¶
- ID_APNIC = 2¶
- ID_ARIN = 1¶
- ID_ICANN = 0¶
- ID_LACNIC = 4¶
- ID_RIPE = 3¶
- RDAP_AFRINIC = 'https://rdap.afrinic.net/rdap/'¶
- RDAP_APNIC = 'https://rdap.apnic.net/'¶
- RDAP_ARIN = 'https://rdap.arin.net/registry/'¶
- RDAP_ICANN = 'https://rdap.iana.org/'¶
- RDAP_LACNIC = 'https://rdap.lacnic.net/rdap/'¶
- RDAP_RIPE = 'https://rdap.db.ripe.net/'¶
- RDAP_SERVERS = {0: 'https://rdap.iana.org/', 1: 'https://rdap.arin.net/registry/', 2: 'https://rdap.apnic.net/', 3: 'https://rdap.db.ripe.net/', 4: 'https://rdap.lacnic.net/rdap/', 5: 'https://rdap.afrinic.net/rdap/'}¶
- detect_server_from_ip(ip)¶
- get_id_from_server(server)¶
- get_octet1_by_ip(ip)¶
- get_octet2_by_ip(ip)¶
- request(ip, url=None)¶
- request_http(url, n=1, max_redirect=5)¶
- request_ip(url, ip=None)¶