Python Workshops for Beginners/Saturday October 25th lecture: Difference between revisions

From OpenHatch wiki
Content added Content deleted
imported>Ehashman
(Remove some lecture content)
imported>Ehashman
No edit summary
Line 1: Line 1:
Welcome to the Saturday lecture section of the Boston Python Workshop! For about 2 hours, we'll work through an introduction to the Python programming language via both a lecture and hand-on exercises.

== Resources ==

* [[Python data types cheat sheet]]
* [[Python loops cheat sheet]]
* [http://csclub.uwaterloo.ca/~ehashman/pwfb/pwfb-2lec.pdf Full slides deck]

== Lecture Outline ==
== Lecture Outline ==


Line 29: Line 37:
#* for popular APIs, there are python modules that help you make requests and parse json!
#* for popular APIs, there are python modules that help you make requests and parse json!
#* rate limiting
#* rate limiting
#* authentication
#* authenticaiton
#* text encoding issues
#* text encoding issues

Revision as of 23:20, 21 October 2014

Welcome to the Saturday lecture section of the Boston Python Workshop! For about 2 hours, we'll work through an introduction to the Python programming language via both a lecture and hand-on exercises.

Resources

Lecture Outline

  1. Introduction to APIs
    • definition of API: just an interface for programs
    • 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)
      • every API is different, and documented
    • 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
  2. New programming concepts:
    • urllib2 and urlopen
    • interpolate variables into a string using % and %()s
    • open files and write to them
  3. placekitten.com
    • API that takes specially crafted URLs and gives appropriately sized picture of kittens
    • example of placekitten in browser
      • visit the API documentation
      • kittens of different sizes
      • kittens in greyscale or color
    • show how to use place
    • write a small program to grab arbitrary square from placekitten by asking for the size on standard in
  4. 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
    • authentication
    • text encoding issues