()
| 42 | |
| 43 | |
| 44 | def main(): |
| 45 | # define a variable to hold the source URL |
| 46 | # In this case we'll use the free data feed from the USGS |
| 47 | # This feed lists all earthquakes for the last day larger than Mag 2.5 |
| 48 | urlData = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.geojson" |
| 49 | |
| 50 | # Open the URL and read the data |
| 51 | webUrl = urllib.request.urlopen(urlData) |
| 52 | print("result code: " + str(webUrl.getcode())) |
| 53 | if (webUrl.getcode() == 200): |
| 54 | data = webUrl.read().decode("utf-8") |
| 55 | # print out our customized results |
| 56 | printResults(data) |
| 57 | else: |
| 58 | print("Received an error from server, cannot retrieve results " + |
| 59 | str(webUrl.getcode())) |
| 60 | |
| 61 | |
| 62 | if __name__ == "__main__": |
no test coverage detected