Python and APIs

Python and APIs

Slide deck from a talk given by @jwpe, @cameronmaske, @fheisler at Intoxicoders DC on March 27, 2013.

1b1660c935a4fd4eb7582f1e4ea49788?s=128

intoxicoders

March 27, 2013
Tweet

Transcript

  1. Brewing with APIs Using web interfaces through Python

  2. None
  3. Ingredients • Overview of APIs • Getting started with Python

    • HTTP and requests • Ask and you shall receive • Meet JSON • Show me the beer!
  4. Overview of APIs • What is an API? • Why

    are they useful? • Get some REST • Do your homework
  5. Getting started with Python • Why Python? • Visit the

    cheese shop
  6. HTTP and Requests • GET some ◦ List - /beers/

    ◦ Single - /beer/1/ • Parameters • Learn to share (POST) • Status codes ◦ 200 OK ◦ 403 Forbidden ◦ 404 Not Found ◦ 5xx server errors ◦ 3xx redirect
  7. Ask and you shall receive • Making Requests in Python

    • Passing parameters ◦ {Key: value} pairs
  8. Meet JSON • Who's JSON? • Using JSON in Python

    • Don't lose your keys
  9. Show me the beer! • How can we use the

    API to search for a beer? ◦ Raw input ◦ Queries ◦ Printing a result
  10. Lager than Life • Find some hearty organic beers with

    an ABV of above 9%
  11. Beer or far? • Where's the closest brewery to me?

    ◦ 38.906116, -77.043324