SlideShare a Scribd company logo
1 of 33
Download to read offline
Fun! with the Twitter API 
Stephanie Kim, @stephlkim 
Erin Shellman, @erinshellman 
! 
June 30, 2014 
Seattle PyLadies presents…
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 containing specialized 
classes.
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.
What could you build?
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
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, DELETE) 
• Header - Send over any required values, like 
security tokens. 
• Body - What resource are you asking for?
request line 
header 
body
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.
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
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.
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.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

More Related Content

What's hot

Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Simplilearn
 

What's hot (20)

Api testing
Api testingApi testing
Api testing
 
API Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj RollisonAPI Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj Rollison
 
利用 Appium + Robot Framework 實現跨平台 App 互動測試
利用 Appium + Robot Framework 實現跨平台 App 互動測試利用 Appium + Robot Framework 實現跨平台 App 互動測試
利用 Appium + Robot Framework 實現跨平台 App 互動測試
 
API World Conference
API World ConferenceAPI World Conference
API World Conference
 
Belajar Postman test runner
Belajar Postman test runnerBelajar Postman test runner
Belajar Postman test runner
 
Cucumber with appium
Cucumber with appiumCucumber with appium
Cucumber with appium
 
4 Major Advantages of API Testing
4 Major Advantages of API Testing4 Major Advantages of API Testing
4 Major Advantages of API Testing
 
Pentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang BhatnagarPentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang Bhatnagar
 
Automated API pentesting using fuzzapi
Automated API pentesting using fuzzapiAutomated API pentesting using fuzzapi
Automated API pentesting using fuzzapi
 
What's new in Rails 4.1
What's new in Rails 4.1What's new in Rails 4.1
What's new in Rails 4.1
 
How to Automate API Testing
How to Automate API TestingHow to Automate API Testing
How to Automate API Testing
 
Slideshare API
Slideshare APISlideshare API
Slideshare API
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
 
Api Testing
Api TestingApi Testing
Api Testing
 
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
 
Mobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason HugginsMobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason Huggins
 
Souvik_CV
Souvik_CVSouvik_CV
Souvik_CV
 
Cucumber questions
Cucumber questionsCucumber questions
Cucumber questions
 
API Test Automation Tips and Tricks
API Test Automation Tips and TricksAPI Test Automation Tips and Tricks
API Test Automation Tips and Tricks
 
Testing APIs in the Cloud
Testing APIs in the CloudTesting APIs in the Cloud
Testing APIs in the Cloud
 

Similar to Fun! with the Twitter API

Similar to Fun! with the Twitter API (20)

Building Social Tools
Building Social ToolsBuilding Social Tools
Building Social Tools
 
API Docs with OpenAPI 3.0
API Docs with OpenAPI 3.0API Docs with OpenAPI 3.0
API Docs with OpenAPI 3.0
 
A RESTful Interface for Erlang Code using Webmachine
A RESTful Interface for Erlang Code using WebmachineA RESTful Interface for Erlang Code using Webmachine
A RESTful Interface for Erlang Code using Webmachine
 
Api fundamentals
Api fundamentalsApi fundamentals
Api fundamentals
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
Creating a RESTful api without losing too much sleep
Creating a RESTful api without losing too much sleepCreating a RESTful api without losing too much sleep
Creating a RESTful api without losing too much sleep
 
Api FUNdamentals #MHA2017
Api FUNdamentals #MHA2017Api FUNdamentals #MHA2017
Api FUNdamentals #MHA2017
 
Super simple introduction to REST-APIs (2nd version)
Super simple introduction to REST-APIs (2nd version)Super simple introduction to REST-APIs (2nd version)
Super simple introduction to REST-APIs (2nd version)
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
 
Facebook & Twitter API
Facebook & Twitter APIFacebook & Twitter API
Facebook & Twitter API
 
Создание API, которое полюбят разработчики. Глубокое погружение
Создание API, которое полюбят разработчики. Глубокое погружениеСоздание API, которое полюбят разработчики. Глубокое погружение
Создание API, которое полюбят разработчики. Глубокое погружение
 
flask.pptx
flask.pptxflask.pptx
flask.pptx
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Why should I care about REST?
Why should I care about REST?Why should I care about REST?
Why should I care about REST?
 
Build and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API GatewayBuild and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API Gateway
 
Documenting REST APIs
Documenting REST APIsDocumenting REST APIs
Documenting REST APIs
 
Logical Attacks(Vulnerability Research)
Logical Attacks(Vulnerability Research)Logical Attacks(Vulnerability Research)
Logical Attacks(Vulnerability Research)
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)
 
API SECURITY
API SECURITYAPI SECURITY
API SECURITY
 

More from Erin Shellman

More from Erin Shellman (9)

Case studies in data-driven merchandising
Case studies in data-driven merchandisingCase studies in data-driven merchandising
Case studies in data-driven merchandising
 
Building Robust Pipelines with Airflow
Building Robust Pipelines with AirflowBuilding Robust Pipelines with Airflow
Building Robust Pipelines with Airflow
 
Catching the most with high-throughput screening
Catching the most with high-throughput screeningCatching the most with high-throughput screening
Catching the most with high-throughput screening
 
Developing effective data scientists
Developing effective data scientistsDeveloping effective data scientists
Developing effective data scientists
 
Bot or Not
Bot or NotBot or Not
Bot or Not
 
Downloading the internet with Python + Scrapy
Downloading the internet with Python + ScrapyDownloading the internet with Python + Scrapy
Downloading the internet with Python + Scrapy
 
real time real talk
real time real talkreal time real talk
real time real talk
 
Collaborative Filtering for fun ...and profit!
Collaborative Filtering for fun ...and profit!Collaborative Filtering for fun ...and profit!
Collaborative Filtering for fun ...and profit!
 
Assumptions: Check yo'self before you wreck yourself
Assumptions: Check yo'self before you wreck yourselfAssumptions: Check yo'self before you wreck yourself
Assumptions: Check yo'self before you wreck yourself
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

Fun! with the Twitter API

  • 1. Fun! with the Twitter API Stephanie Kim, @stephlkim Erin Shellman, @erinshellman ! June 30, 2014 Seattle PyLadies presents…
  • 2.
  • 3. Every other Monday. http://www.meetup.com/Seattle-PyLadies/
  • 4. Intro to Python http://www.meetup.com/Girl-Develop-It-Seattle/
  • 5. APIs describe how software communicates • Application Programming Interfaces often come in the form of a module containing specialized classes.
  • 6.
  • 7.
  • 8. 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.
  • 9. What could you build?
  • 10.
  • 11. 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
  • 12. Lets get some tokens! https://apps.twitter.com/
  • 13. Reading documentation is 90% https://dev.twitter.com/docs/api/1.1
  • 14. Request verbs • There are 5 common methods a client can apply to a resource: • GET • HEAD • POST • PUT • DELETE
  • 15. 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?
  • 17. 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.
  • 18. 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
  • 19. 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.
  • 21.
  • 22.
  • 23.
  • 25.
  • 27.
  • 28.
  • 29.
  • 30.
  • 32. Teaser for next time: http://it-stinks.herokuapp.com/
  • 33. 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