Community Data Science Workshops (Spring 2014)/Saturday May 3rd lecture: Difference between revisions
Content added Content deleted
imported>Mako No edit summary |
imported>Mako |
||
Line 2: | Line 2: | ||
# API |
# API |
||
#* definition of an |
#* definition of API: just an interface for programs |
||
#* definition of web API |
#* definition of web API |
||
#** way to ask for data (almost always a URL) |
|||
#** way to get data back (almost always in a format called JSON) |
|||
#* to use APIs to build a dataset we will need: |
|||
#** all our tools from last session: variables, etc |
|||
#** the ability to open urls on the web |
|||
#** the ability to create custom URLS |
|||
#** the ability to save to files |
|||
#** the ability to understand (i.e., parse) JSON data that APIs usually give us |
|||
# Review material from last session |
# Review material from last session |
||
#* variables, different types |
#* variables, different types |
||
Line 16: | Line 24: | ||
#* urllib2 and urlopen |
#* urllib2 and urlopen |
||
#* interpolate variables into a string using % and %()s |
#* interpolate variables into a string using % and %()s |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
# [http://placekitten.com/ placekitten.com] |
# [http://placekitten.com/ placekitten.com] |
||
#* API that takes specially crafted URLs and gives appropriately sized picture of kittens |
#* API that takes specially crafted URLs and gives appropriately sized picture of kittens |
||
Line 31: | Line 31: | ||
#* show how to use place |
#* show how to use place |
||
#* write a small program to grab arbitrary square from placekitten by asking for the size on standard in |
#* write a small program to grab arbitrary square from placekitten by asking for the size on standard in |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
# Wikipedia API |
# Wikipedia API |
||
#* explain MediaWiki, exists on other wikis |
#* explain MediaWiki, exists on other wikis |