e1d39a4c9158c9a9db1218cb5be9946152e2ca1b,src/fetch_cnpj_info.py,,fetch_cnpj_info,#Any#Any#,82
Before Change
def fetch_cnpj_info(cnpj, timeout=5):
url = "http://receitaws.com.br/v1/cnpj/%s" % cnpj
print("Fetching %s" % cnpj)
json_contents = urlopen(url, timeout=timeout).read().decode("utf-8")
return json.loads(json_contents)
def write_cnpj_info(cnpj, cnpj_info):
After Change
None]
url = "http://receitaws.com.br/v1/cnpj/%s" % cnpj
print("Fetching %s" % cnpj)
try:
result = requests.get(url,
timeout=timeout,
// proxies={"http": random.choice(candidate_proxies)}
)
if result.status_code == 200:
return result.json()
elif result.status_code == 429:
print(result.text)
print("Sleeping 60 seconds to try again.")
time.sleep(60)
else:
print(result.text)
except requests.exceptions.Timeout as e:
print(e)
except requests.exceptions.ConnectionError as e:
print(e)
def extract_dataset_name(filepath):
date = re.compile("\d+-\d+-\d+-").findall(os.path.basename(filepath))
if date:
filename_without_date = os.path.basename(filepath).replace(date[0], "")
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: okfn-brasil/serenata-de-amor
Commit Name: e1d39a4c9158c9a9db1218cb5be9946152e2ca1b
Time: 2017-04-14
Author: marcus.rehm@gmail.com
File Name: src/fetch_cnpj_info.py
Class Name:
Method Name: fetch_cnpj_info
Project Name: home-assistant/home-assistant
Commit Name: f1cbb2a0b3aa3bf9ddf8ffb1a97b910cd00dec74
Time: 2019-06-20
Author: ville.skytta@iki.fi
File Name: homeassistant/components/braviatv/media_player.py
Class Name:
Method Name: setup_bravia
Project Name: Calamari-OCR/calamari
Commit Name: e3673091d04ef00cea5d7d8bcac69c0dee40e585
Time: 2021-01-19
Author: wick.chr@gmail.com
File Name: calamari_ocr/utils/multiprocessing.py
Class Name:
Method Name: run