Skip to content

Commit 786a678

Browse files
author
Charlotte Weaver
committed
Project for lesson 11
1 parent b4d3d82 commit 786a678

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

Lesson11_JSONandAPIs/JSONandAPIs.ipynb

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -206,23 +206,24 @@
206206
"cell_type": "markdown",
207207
"metadata": {},
208208
"source": [
209-
"## APIs\n",
209+
"## Web APIs\n",
210210
"\n",
211211
"Web APIs are a way to retreive and send data to and from a url. The urls have a pattern so that you can retreive data programtically. With REST APIs specifically, you build a url putting data in the correct places to retreive the data you need. Many Web APIs (the best ones) return their data in JSON format. \n",
212212
"\n",
213213
"There are many free api's available, most require that you sign up to recieve an API key. You will need to read the API docs for any specific api to figure out how to get the data you want.\n",
214214
"\n",
215215
"Here are some fun APIs to try out:\n",
216-
"Dropbox: https://www.dropbox.com/developers\n",
217-
"Google Maps: https://developers.google.com/maps/web/\n",
218-
"Twitter: https://dev.twitter.com/docs\n",
219-
"YouTube: https://developers.google.com/youtube/v3/getting-started\n",
220-
"Soundcloud: http://developers.soundcloud.com/docs/api/guide#playing\n",
221-
"Stripe: https://stripe.com/docs/tutorials/checkout\n",
222-
"Instagram: http://instagram.com/developer/\n",
223-
"Twilio: https://www.twilio.com/docs\n",
224-
"Yelp: http://www.yelp.com/developers/getting_started\n",
225-
"Facebook: https://developers.facebook.com/docs/facebook-login/login-flow-for-web\n",
216+
"* Dropbox: https://www.dropbox.com/developers\n",
217+
"* Google Maps: https://developers.google.com/maps/web/\n",
218+
"* Twitter: https://dev.twitter.com/docs\n",
219+
"* YouTube: https://developers.google.com/youtube/v3/getting-started\n",
220+
"* Soundcloud: http://developers.soundcloud.com/docs/api/guide#playing\n",
221+
"* Stripe: https://stripe.com/docs/tutorials/checkout\n",
222+
"* Instagram: http://instagram.com/developer/\n",
223+
"* Twilio: https://www.twilio.com/docs\n",
224+
"* Yelp: http://www.yelp.com/developers/getting_started\n",
225+
"* Facebook: https://developers.facebook.com/docs/facebook-login/login-flow-for-web\n",
226+
"* Etsy: https://www.etsy.com/developers/documentation\n",
226227
"\n",
227228
"We are going to use the steam api because certain endpoints don't require an app id (and who has time to sign up for one when there is python to learn?)\n",
228229
"\n",
@@ -498,8 +499,28 @@
498499
"cell_type": "markdown",
499500
"metadata": {},
500501
"source": [
501-
"# Project"
502+
"# Project\n",
503+
"\n",
504+
"1. You will need to sign up for a open weather api key here (FREE tier) http://openweathermap.org/price **WARNING** The free tier only let you make 60 requests an hour, so be conservitave when testing your code.\n",
505+
"\n",
506+
"2. After you sign up for an api key and then go look at the documentation for current weather: http://openweathermap.org/current\n",
507+
"\n",
508+
"3. Pick a list of three cities [London, Paris, New York] for example and use a for loop to get the current weather for each one. Use urllib2 to fetch the data from the url and the json library to decode the data into a python dictionary. \n",
509+
"\n",
510+
"4. Print the weather under the key 'weather' and then under 'description'. **HINT** Look at the result of the json in your web browser before you try to use it in your code.\n",
511+
"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={appid}\n",
512+
"\n",
513+
"\n"
502514
]
515+
},
516+
{
517+
"cell_type": "code",
518+
"execution_count": null,
519+
"metadata": {
520+
"collapsed": true
521+
},
522+
"outputs": [],
523+
"source": []
503524
}
504525
],
505526
"metadata": {
@@ -518,7 +539,7 @@
518539
"name": "python",
519540
"nbconvert_exporter": "python",
520541
"pygments_lexer": "ipython2",
521-
"version": "2.7.10"
542+
"version": "2.7.11"
522543
}
523544
},
524545
"nbformat": 4,

0 commit comments

Comments
 (0)