Skip to content

Instantly share code, notes, and snippets.

@mauforonda
Created May 5, 2019 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauforonda/ff236cd408844ee63a1befdf4483fcc4 to your computer and use it in GitHub Desktop.
Save mauforonda/ff236cd408844ee63a1befdf4483fcc4 to your computer and use it in GitHub Desktop.
import requests, json, os
def download(city):
with open("agbc/" + city.replace(" ", "_")+".json", "w") as f:
json.dump(requests.get("https://www.oopp.gob.bo/ajax/ecobolCorrespondenciaPorNombreDepartamento/" + city).json(), f, ensure_ascii=False, indent=2)
os.mkdir("agbc")
[download(city) for city in ["COCHABAMBA", "LA PAZ", "ORURO", "POTOSI", "SANTA CRUZ", "SUCRE"]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment