Created
August 21, 2017 05:45
-
-
Save woohgit/d77ea7fe23d8cee59173aef01d2b99bd to your computer and use it in GitHub Desktop.
Earthquake feeds (3)
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
import urllib | |
import json | |
def report_eq(): | |
# API documentation: | |
# https://earthquake-report.com/2013/06/29/earthquake-report-com-json-and-rss-feeds/ | |
url = "http://earthquake-report.com/feeds/recent-eq?json" | |
try: | |
entries = json.loads(urllib.urlopen(url).read()) | |
for entry in entries: | |
if "JAPAN" in entry['location'].upper(): | |
jishin = entry | |
break | |
except Exception: | |
pass | |
# API documentation: | |
# http://www.p2pquake.com/dev/?q=json-api | |
url = "http://api.p2pquake.com/v1/human-readable" | |
try: | |
entries = json.loads(urllib.urlopen(url).read()) | |
for entry in entries: | |
if "_id" in entry: | |
jishin2 = entry | |
except Exception: | |
pass | |
# API documentation: | |
# https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php | |
url = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson" | |
try: | |
entries = json.loads(urllib.urlopen(url).read()) | |
for entry in entries["features"]: | |
if "JAPAN" in entry['properties']['place'].upper(): | |
jishin3 = entry | |
break | |
except Exception: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment