Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Fun! with the Twitter API 
Stephanie Kim, @stephlkim 
Erin Shellman, @erinshellman 
! 
June 30, 2014 
Seattle PyLadies pre...
Every other Monday. 
http://www.meetup.com/Seattle-PyLadies/
Intro to Python 
http://www.meetup.com/Girl-Develop-It-Seattle/
APIs describe how 
software communicates 
• Application Programming Interfaces often come in 
the form of a module contain...
REST APIs interface consumers 
with resources on a server 
• Representational state transfer (REST) 
• REST APIs are speci...
What could you build?
OAuth 
OAuth is an open standard that 
allows us to access protected 
resources hosted by a resource 
server. 
https://dev...
Lets get some tokens! 
https://apps.twitter.com/
Reading documentation is 90% 
https://dev.twitter.com/docs/api/1.1
Request verbs 
• There are 5 common methods a client can apply to a 
resource: 
• GET 
• HEAD 
• POST 
• PUT 
• DELETE
The anatomy of a request 
• Request Line - Tells the server what type of 
request is being sent (e.g. GET, POST, PUT, DELE...
request line 
header 
body
Responses 
• A successful request to the server results in a 
response, hopefully containing the resource you 
requested. ...
Response Codes 
• 1__: Working on the request. 
• 2__: Everything’”⁹s cool. 
• 3__: Everything’”⁹s cool, but something els...
The response also has a 
response line, header and body 
• Similarly to the request, a response contains a 
response line,...
https://github.com/Seattle-PyLadies/TwitterApiWorkshop
https://dev.twitter.com/docs/api/1.1/get/statuses/retweets_of_me
https://dev.twitter.com/docs/api/1.1/post/statuses/update
Make your own!
Teaser for next time: 
http://it-stinks.herokuapp.com/
Resources 
1. Programmable Web. http:// 
www.programmableweb.com/ 
2. Designing a RESTful API with Flask. http:// 
blog.mi...
Fun! with the Twitter API
Fun! with the Twitter API
Fun! with the Twitter API
Fun! with the Twitter API
Fun! with the Twitter API
Fun! with the Twitter API
Fun! with the Twitter API
Fun! with the Twitter API
Fun! with the Twitter API
Fun! with the Twitter API
Fun! with the Twitter API
Fun! with the Twitter API
You’ve finished this document.
Download and read it offline.
Upcoming SlideShare
Collaborative Filtering for fun ...and profit!
Next
Upcoming SlideShare
Collaborative Filtering for fun ...and profit!
Next
Download to read offline and view in fullscreen.

Share

Fun! with the Twitter API

Download to read offline

This was a fun workshop introducing the core functionality of the Twitter API, presented by myself and Stephanie Kim of Seattle PyLadies.

Related Books

Free with a 30 day trial from Scribd

See all

Fun! with the Twitter API

  1. 1. Fun! with the Twitter API Stephanie Kim, @stephlkim Erin Shellman, @erinshellman ! June 30, 2014 Seattle PyLadies presents…
  2. 2. Every other Monday. http://www.meetup.com/Seattle-PyLadies/
  3. 3. Intro to Python http://www.meetup.com/Girl-Develop-It-Seattle/
  4. 4. APIs describe how software communicates • Application Programming Interfaces often come in the form of a module containing specialized classes.
  5. 5. REST APIs interface consumers with resources on a server • Representational state transfer (REST) • REST APIs are specifications of remote calls exposed to API consumers. 1. Separate client from server. 2. Stateless. 3. Use HTTP/HTTPS.
  6. 6. What could you build?
  7. 7. OAuth OAuth is an open standard that allows us to access protected resources hosted by a resource server. https://dev.twitter.com/docs/auth/authorizing-request
  8. 8. Lets get some tokens! https://apps.twitter.com/
  9. 9. Reading documentation is 90% https://dev.twitter.com/docs/api/1.1
  10. 10. Request verbs • There are 5 common methods a client can apply to a resource: • GET • HEAD • POST • PUT • DELETE
  11. 11. The anatomy of a request • Request Line - Tells the server what type of request is being sent (e.g. GET, POST, PUT, DELETE) • Header - Send over any required values, like security tokens. • Body - What resource are you asking for?
  12. 12. request line header body
  13. 13. Responses • A successful request to the server results in a response, hopefully containing the resource you requested. • The response will contain a 3-digit status code starting with 1, 2, 3, 4, or 5.
  14. 14. Response Codes • 1__: Working on the request. • 2__: Everything’”⁹s cool. • 3__: Everything’”⁹s cool, but something else is happening. • 4__: Oh man, not cool. • 5__: The server errored out. See: https://dev.twitter.com/docs/error-codes-responses
  15. 15. The response also has a response line, header and body • Similarly to the request, a response contains a response line, a header and a body.
  16. 16. https://github.com/Seattle-PyLadies/TwitterApiWorkshop
  17. 17. https://dev.twitter.com/docs/api/1.1/get/statuses/retweets_of_me
  18. 18. https://dev.twitter.com/docs/api/1.1/post/statuses/update
  19. 19. Make your own!
  20. 20. Teaser for next time: http://it-stinks.herokuapp.com/
  21. 21. Resources 1. Programmable Web. http:// www.programmableweb.com/ 2. Designing a RESTful API with Flask. http:// blog.miguelgrinberg.com/post/designing-a-restful-api-with- python-and-flask 3. Cool mashups made possible with APIs. http:// mashable.com/2009/10/08/top-mashups/ 4. Great book about REST APIs. http://www.amazon.com/ RESTful-Web-APIs-Leonard-Richardson-ebook/dp/ B00F5BS966
  • LucaBonifacio

    Feb. 3, 2016

This was a fun workshop introducing the core functionality of the Twitter API, presented by myself and Stephanie Kim of Seattle PyLadies.

Views

Total views

1,328

On Slideshare

0

From embeds

0

Number of embeds

237

Actions

Downloads

18

Shares

0

Comments

0

Likes

1

×