Editing DS4UX (Spring 2016)/Day 5 lecture
From CommunityData
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 28: | Line 28: | ||
* Web APIs: like a website your programs can visit (you:a website::your program:a web API) | * Web APIs: like a website your programs can visit (you:a website::your program:a web API) | ||
=== How do we use an API to fetch datasets? === | === How do we use an API to fetch datasets? === | ||
Line 58: | Line 53: | ||
** kittens of different sizes | ** kittens of different sizes | ||
** kittens in greyscale or color | ** kittens in greyscale or color | ||
* Now we | * Now we write a small program to grab an arbitrary square from placekitten by asking for the size on standard in. | ||
== Lecture 2: Using data from APIs in Python == | == Lecture 2: Using data from APIs in Python == | ||
Line 75: | Line 72: | ||
* what is json: useful for more structured data | * what is json: useful for more structured data | ||
* import json; | * import json; json.loads() | ||
* like Python (except no single quotes) | * like Python (except no single quotes) | ||
* simple lists, dictionaries | * simple lists, dictionaries | ||
* can reflect more complicated data structures | * can reflect more complicated data structures | ||
* Example file at FIXME | |||
* You can parse data directly with <code>.json()</code> on a <code>requests</code> call | * You can parse data directly with <code>.json()</code> on a <code>requests</code> call | ||
=== Using other APIs === | === Using other APIs === |