Skip to content

Instantly share code, notes, and snippets.

@fernandobarbalho
fernandobarbalho / consome_api_dados_gov_br.r
Last active September 6, 2023 14:27
O código abaixo mostra como consumir dados de dados.gov.br a partir da API de consumo de dados disponibilizada
library(jsonlite)
# load the httr package
library(httr)
#Você deve ter uma chave gerada de API. Para isso você precisa criar um usuário na página dados.gov.br usando o gov.br
my_key<- "<sua_chave_aqui>"
# Define the API endpoint and headers
url <- "https://dados.gov.br/dados/api/publico/conjuntos-dados"
@jsoma
jsoma / Downloading a list of files with Python.ipynb
Created December 7, 2021 17:13
How to download a list of files using Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hantoine
hantoine / download_and_unzip.py
Last active June 28, 2025 14:55
Download and extract a ZIP file in Python
from urllib.request import urlopen
from io import BytesIO
from zipfile import ZipFile
def download_and_unzip(url, extract_to='.'):
http_response = urlopen(url)
zipfile = ZipFile(BytesIO(http_response.read()))
zipfile.extractall(path=extract_to)