Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Change the geojson.py program to print out the two-character country code from the retrieved data.2. Add error checkingtry: except:so your program does not traceback if

Change the geojson.py program to print out the two-character country code from the retrieved data.2. Add error checkingtry: except:so your program does not traceback if the country code is not there. Hint: try this code...names = {'wynken': 1, 'blynken': 5, 'nod': 42}print(names['Fred'])# Note that a keyerror is a kind of exception, however,# the exception you encounter in this assignment might not be a keyerror.As one more hint, if you look at the data carefully, you may find that the country tag is especially interesting.3. Use the program to try: to retrieve the country code JSON element and make sure that it can handle locations that do not exist (such as Pacific Ocean). By the way, if the location does not exist, then the data structure element wont either (thats yet another hint!).4. Your except: will handle non-existing locations by printing the message There is no country code for that location..5. Your program does not need to print the entire JSON structure.6. Use the program to search for San Diego and Pacific Ocean and take a screenshot of the results.You can find the documentation for the Google Maps Platform Web Services Geocoding API here: https://developers.google.com/maps/documentation/geocoding/start. The default API key should work fine. However, if you register with a credit card account to obtain an your own API key, youll also need to update the textbook Geocode example with your API key information. Regardless of how you obtain your API key, at the time that you enable the Google Maps Platform youll also need to pick the Places API as your product. If you click on the Get started button at the above URL, you will be guided through the step by step process of 1) Picking your product (Places API), 2) Selecting a project, and 3) Setting up your billing.Deliverables:

Two files as attachments at our course shell assignment page. The first file should be the Python .py that you chose to modify. The second file should be a screenshot image file (.png or .jpg) demonstrating the correct execution of your program. Your screenshot image should show the correct response for a location that has a country code (such as San Diego), as well as a response (using the message stipulated above) for a location that does not have a country code (such as Pacific Ocean).

Submission Deadline:Please see the course schedule in our syllabus for all assignment submission deadlines.

Option 2: Alpha-VantageDescription:1. Change the geojson.py program to print out the 05. price from the retrieved data.2. Add error checkingtry: except:so your program does not traceback if the 05. price is not there. You may not use an if/else construct for this logic.3. Use the program to try: to retrieve the 05. price JSON element and make sure that it can handle stock ticker symbols that do not exist (such as FAKE).4. Your except: will handle non-existing stock tickers symbols by printing a message such as There is no price for that stock..5. Your program does not need to print the entire JSON structure.6. Use the program to search for WMT and FAKE and take a screenshot of the results.You can find the documentation for the Alpha-Vantage Stock Time Series Quote Endpoint APIhere: https://www.alphavantage.co/documentation/. Specifically, youll be looking at the Quote Endpoint API instructions and examples. Use the Stock Time Series Quote Endpoint to obtain the latest price and volume information for the stock tickers WMT and FAKE. After receiving the result of your API query, youll want to retrieve the Global Quote, 05. price JSON element.Deliverables:

Two files as attachments at our course shell assignment page. The first file should be the Python .py that you chose to modify. The second file should be a screenshot image file (.png or .jpg) demonstrating the correct execution of your program. Your screenshot image should show the correct response for stock ticker symbol WMT, as well as a response for the stock ticker symbol FAKE (which does not exist).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

Students also viewed these Databases questions

Question

4.5. Explain the value of benefit corporations

Answered: 1 week ago