|
206 | 206 | "cell_type": "markdown", |
207 | 207 | "metadata": {}, |
208 | 208 | "source": [ |
209 | | - "## APIs\n", |
| 209 | + "## Web APIs\n", |
210 | 210 | "\n", |
211 | 211 | "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", |
212 | 212 | "\n", |
213 | 213 | "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", |
214 | 214 | "\n", |
215 | 215 | "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", |
226 | 227 | "\n", |
227 | 228 | "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", |
228 | 229 | "\n", |
|
498 | 499 | "cell_type": "markdown", |
499 | 500 | "metadata": {}, |
500 | 501 | "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" |
502 | 514 | ] |
| 515 | + }, |
| 516 | + { |
| 517 | + "cell_type": "code", |
| 518 | + "execution_count": null, |
| 519 | + "metadata": { |
| 520 | + "collapsed": true |
| 521 | + }, |
| 522 | + "outputs": [], |
| 523 | + "source": [] |
503 | 524 | } |
504 | 525 | ], |
505 | 526 | "metadata": { |
|
518 | 539 | "name": "python", |
519 | 540 | "nbconvert_exporter": "python", |
520 | 541 | "pygments_lexer": "ipython2", |
521 | | - "version": "2.7.10" |
| 542 | + "version": "2.7.11" |
522 | 543 | } |
523 | 544 | }, |
524 | 545 | "nbformat": 4, |
|
0 commit comments