Created
January 12, 2015 21:29
-
-
Save fprieur/51c2e61a05f5a6b89045 to your computer and use it in GitHub Desktop.
Scan montreal open data resource
This file contains 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
# coding: utf-8 | |
from bs4 import BeautifulSoup | |
import requests | |
import json | |
r = requests.get("http://donnees.ville.montreal.qc.ca/api/3/action/package_list") | |
binary = r.content | |
output = json.loads(binary) | |
for package in output["result"]: | |
r = requests.get("http://donnees.ville.montreal.qc.ca/dataset/"+package) | |
data = r.text | |
soup = BeautifulSoup(data) | |
for resource_link in soup.findAll("a", {"class": "resource-url-analytics"}): | |
print(resource_link.get('href')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment