Community Data Science Workshops (Spring 2014)/Saturday May 3rd lecture

Lecture Outline

 * 1) Review material from last session
 * 2) * variables, different types
 * 3) * printing
 * 4) * if statements
 * 5) * lists
 * 6) * dictionaries
 * 7) * for loops
 * 8) * modules
 * 9) * example python program
 * 10) New programming concepts:
 * 11) * open a file and write to it
 * 12) * open a file and append to it
 * 13) * join a string together
 * 14) * interpolate variables into a string using % and %s
 * 15) * from syntax for importing
 * 16) * urllib2 and urlopen
 * 17) * JSON file
 * 18) API
 * 19) * definition of an API in general
 * 20) * definition of web API for data
 * 21) placekitten.com
 * 22) * API that takes specially crafted URLs and gives appropriately sized picture of kittens
 * 23) * example of placekitten in browser
 * 24) ** kittens of different sizes
 * 25) ** kittens in greyscale or color
 * 26) * show how to use place
 * 27) * write a small program to grab arbitrary square from placekitten by asking for the size on standard in
 * 28) Wikipedia API
 * 29) * explain MediaWiki, exists on other wikis
 * 30) * navigate to api page and show the documentation, point out examples
 * 31) * looking at the images within a page http://en.wikipedia.org/w/api.php?action=query&titles=Seattle&prop=images&imlimit=20&format=jsonfm
 * 32) * looking at within two pages http://en.wikipedia.org/w/api.php?action=query&titles=Seattle|Bellevue,_Washington&prop=images&imlimit=50&format=jsonfm
 * 33) * edit count http://en.wikipedia.org/w/api.php?action=query&list=users&ususers=Benjamin_Mako_Hill|Jtmorgan|Sj|Mindspillage&usprop=editcount&format=jsonfm
 * 34) * give me the content of the main page http://en.wikipedia.org/w/api.php?format=json&action=query&titles=Main%20Page&prop=revisions&rvprop=content
 * 35) Other APIs
 * 36) * every API is different, so read the documentation!
 * 37) * rate limiting
 * 38) * authenticaiton
 * 39) * text encoding issues