Skip to content

Instantly share code, notes, and snippets.

Avatar
🥦
stay healthy

Fernanda Scovino fernandascovino

🥦
stay healthy
View GitHub Profile
@turicas
turicas / brasil_io.py
Last active Oct 18, 2021
Exemplo de código para acessar dados do Brasil.IO
View brasil_io.py
import csv
import gzip
import io
import json
from urllib.parse import urlencode, urljoin
from urllib.request import Request, urlopen
class BrasilIO:
View safely_access_key_from_nested_dict.py
def accessr(d, keys, default=None):
if len(keys) and d is not None:
return accessr(d.get(keys[0], default), keys[1:], default)
else:
return d
def access(d, keys, default=None):
for k in keys:
if d is not None:
d = d.get(k, default)