Community Data Science Workshops (Spring 2014)/Saturday May 3rd lecture: Difference between revisions

m
moved to wiki.communitydata.cc
imported>Mako
imported>Jtmorgan
m (moved to wiki.communitydata.cc)
 
(6 intermediate revisions by one other user not shown)
Line 1:
{{CDSW_Moved}}
== Lecture Outline ==
 
Line 14 ⟶ 15:
#** the ability to understand (i.e., parse) JSON data that APIs usually give us
# Review material from last session
#* variables, different types
#* printing
#* if statements
#* lists
#* dictionaries
#* if statements
#* for loops
#* printing
#* modules
#* example python program
# New programming concepts:
#* urllib2 and urlopen
#* interpolate variables into a string using % and %()s
#* open files and write to them
# [http://placekitten.com/ placekitten.com]
#* API that takes specially crafted URLs and gives appropriately sized picture of kittens
Line 41 ⟶ 42:
#* Example file at http://mako.cc/cdsw.json
#* download it and parse it
# Wikipedia API
#* explain MediaWiki, exists on other wikis
#* navigate to [http://en.wikipedia.org/w/api.php api page] and show the documentation, point out examples
#* looking at the images within a page http://en.wikipedia.org/w/api.php?action=query&titles=Seattle&prop=images&imlimit=20&format=jsonfm
#* looking at within two pages http://en.wikipedia.org/w/api.php?action=query&titles=Seattle|Bellevue,_Washington&prop=images&imlimit=50&format=jsonfm
#* edit count http://en.wikipedia.org/w/api.php?action=query&list=users&ususers=Benjamin_Mako_Hill|Jtmorgan|Sj|Mindspillage&usprop=editcount&format=jsonfm
#* 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
# Other APIs
#* every API is different, so read the documentation!
#* for popular APIs, there are python modules that help you make requests and parse json!
#* rate limiting
#* authenticaiton
Anonymous user