This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |