SlideShare a Scribd company logo
Dr. Sabin Buraga – www.purl.org/net/busaco
Python “sinners” must
R⚗ST
warning:
some sensitive people might consider
this presentation somewhat offensive
in this situation, these persons are advised
to immediately abandon all humour
and better visit gore Websites for the real-life “fun”
Thank you for understanding!
100% pure sarcasm & irony included
So, our Web application
must provide certain
functionalities* to be
consumed by software
(not only by humans)…
* desired data requested via HTTP
http://www.boredpanda.com/funny-chinese-translation-fails/
…Oh, by the way,
what the Web is?

…Oh, by the way,
what the Web is?
content ≅ sexy <mark-ups/>
+ stylish CSS heartaches
http://www.funnypicss.com/humor/i-know-html/
…Oh, by the way,
what the Web is?
interaction ≅ URI + hypermedia
(HTTP delights?)
http://httpstatusdogs.com/
…Oh, by the way,
what the Web is?
development ≅ client and/or
server-side programming %#^&!
paradigms/languages/frameworks/magic/…
http://stressandanger.wordpress.com/funny-pictures/
In order to satisfy some 〠 needs,
the software must offer certain ☠ services*
http://brog.engrish.com/
* the action of helping or doing work for someone
Web service
a piece of s…oftware providing a s…pecific functionality
http://wallpaperstop.co/wallpapers/2013/07/Cats-Funny-Meme-272x480.jpg
Web service
a piece of s…oftware providing a s…pecific functionality
access to resources of (dis)interest – Instagram, Pinterest, Tumblr
boring news aggregators – Digg, Reddit
(“surreal”) maps – Bing Maps, Google Maps, Nokia HERE
instant mess(ages) – Jabber, Twitter, Twilio
world-wide stupidity – see Facebook (Open Graph Protocol)
(unsecure) data storage – Amazon S3, Dropbox, OneDrive
…and many, many, many others
Web service
developed & deployed by using W3C standards
URI (Unicorn Ridiculous Identifier) – aka Web address
access via HTTP (Hyper Trickiest Triviality Provider)
data formats:
JSON (JavaScript Orgiastic Needs)
XML (Exquisite Manual Labor)
…
Web service
a classical implementation:
using certain Web application servers/frameworks
for Python, some popular choices are
Django, Grok, TurboGears, web2py, Zope
https://wiki.python.org/moin/WebFrameworks
generic architecture of a traditional Web application
(N-tier application)
Client Web application Storage
(user interface) server/framework (data persistence)
Internet
(Web)
Web service
goal: processing the answer (data) provided by a given Web
site/application in order to (re)use it in our (client) programs
http://nedhardy.com/2013/04/22/17-hilarious-ad-placement-fails/
Web service
a naïve solution:
Web scraping
extracting data of interest
by parsing (incorrect)
HTML constructs
www.winhdwallpapers.com/funny/funny-html-code-hd-wallpaper-1080p
Web service
Web scraping
several Python libraries:
Beautiful Soup – www.crummy.com/software/BeautifulSoup/
html5lib-python – https://github.com/html5lib/html5lib-python
lxml – http://lxml.de/
Scrappy – http://scrapy.org/
How about an interesting*
paradigm of Web service
development?
* aka pragmatic
http://commons.wikimedia.org/wiki/File:France_Paris_Notre-Dame-Adam_and_Eve.jpg
REST (REpresentational State Transfer)
Web development focused on
the representation(s) of a resource
Roy Fielding – PhD Thesis (2000)
REST (REpresentational State Transfer)
Web development focused on
the representation(s) of a resource
e.g., user, blog, article,
photo, source-code,…
REST (REpresentational State Transfer)
Web development focused on
the representation(s) of a resource
HTML, PNG, SVG, JSON,…
REST (REpresentational State Transfer)
Web development focused on
the representation(s) of a resource
denoted by MIME types:
text/html, application/json,…
each resource can have multiple representations
accessed via HTTP requests
clients (browsers, robots, players,…) interact
with the resource representations via HTTP verbs:
create: POST, retrieve: GET, update: PUT, delete: DELETE
representation2
(Atom)
resource
URI
URLURL
GET POST GET DELETE
representation1
(HTML)
resource1
representation1
(HTML)
http://blog.info/
http://blog.info/post
http://blog.info/post/edit
http://blog.info/news
GET
resource2
resource3
resource4
GET
POST
representation2
(HTML) representation3
(HTML)
representation4
(Atom)
resource1
representation1
(HTML)
http://blog.info/
http://blog.info/post
http://blog.info/post/edit
http://blog.info/news
GET
resource2
resource3
resource4
GET
POST
representation2
(HTML) representation3
(HTML)
representation4
(Atom)
HATEOAS (Hypermedia As The Engine Of Application State)
So, some practical
advises about building
RESTful Web services?
http://www.funpedia.net/imgs/may11/very-funny-signs-06.jpg
Use nouns for each class of resources
to be managed by your service
User
Document – alternatives: Photo, Product, Software
Metadata – e.g., Comment, Format, Platform, Tag,…
Use nouns for each class of resources
to be managed by your service
collections of “things” (typically, plural)
/snakes
unique identifiers for every member of a collection
/snakes/python versus /snakes/69
SoundCloud API
types of resources:
tracks, users, current user (me),
playlists, groups, comments
http://developers.soundcloud.com/
Name each resource by using URLs
http://www.slideshare.net/busaco/presentations
http://www.imdb.com/title/tt0401383/
http://www.last.fm/music/Moby
http://vimeo.com/channels/731014
Design accepted representations to be sent by
potential clients
+
optional parameters
(useful for pagination, partial responses, filtering,…)
/snakes?limit=3&offset=14
/snakes?fields=name,age,description
Choose the representation(s) of the response
to be sent to client
consider existing standardized data formats
e.g., HTML, Atom, JSON,…
Accept: application/json (Digg)
/venue.json (Foursquare)
http://api.sciencemuseum.org.uk/exhibitions/?output=json
interactive access to the data provided by a public Web service
http://developer.nytimes.com/
JSON response
Integrate resources via URLs + Web forms
Create use cases
specify exception/error conditions
via HTTP status codes + additional information
200 OK, 303 See Other, 400 Bad Request, 404 Not Found,…
http://httpstatus.es/
“Never release an API without a version
and make the version mandatory.”—Brian Mulloy (2012)
http://feeds.delicious.com/v2/{format}/{username}
?v=1.0 (Facebook)
Some (programming)
tools for developers?
http://www.weirdasianews.com/category/engrish/
Python HTTP clients
classical built-in modules:
httplib (Python 2)
http.client (Python 3)
Python HTTP clients
a specific library:
Unirest for Python – http://unirest.io/python.html
Developing RESTful Web services in Python
one of our favorite frameworks:
Bottle, CheeryPy, Django REST, Flask, web.py
using a Python wrapper for
a specific Web service/API:
www.pythonapi.com
Useful Web resources
for learning & making
experiments?
building a REST service:
Learn REST: A RESTful Tutorial
www.restapitutorial.com
Thoughts on RESTful API Design
https://restful-api-design.readthedocs.org
Implementing REST
https://code.google.com/p/implementing-rest/
testing our/others APIs:
Make HTTP Requests
http://www.hurl.it/
HTTP Request & Response
http://httpbin.org/
Apigee Console
https://apigee.com/console/
don’t forget to consult:
ProgrammableWeb
http://www.programmableweb.com/
The Web engineer’s online toolbox
ivanzuzak.info/2012/11/18/the-web-engineers-online-toolbox.html
R⚗ST
(and some Python)
http://photos1.blogger.com/blogger/3043/2944/1600/woman-snake-1280.jpg

More Related Content

PDF
Codigo Procesal Penal Comentado - Francisco D´Albora
PDF
Web05 dezvoltareaaplicatiilorweb php
PDF
Tapestry
PDF
Esență de JavaScript pentru novici
PDF
Limbajul JavaScript: o prezentare generală
PDF
Căutarea resurselor Web
PDF
Snickers Workwear Novedades Otoño-Invierno 2014
PDF
Open source delivers great digital experiences
Codigo Procesal Penal Comentado - Francisco D´Albora
Web05 dezvoltareaaplicatiilorweb php
Tapestry
Esență de JavaScript pentru novici
Limbajul JavaScript: o prezentare generală
Căutarea resurselor Web
Snickers Workwear Novedades Otoño-Invierno 2014
Open source delivers great digital experiences

Viewers also liked (16)

PDF
BCUR Poster
DOCX
Formato 500 cartas jimenez 10a
PPTX
Spice world london 2012 Ben Snape
PPS
Los conocemos mejor que tu
PPTX
Local Commerce – Wird der stationäre Handel wieder eine Chance verpassen?
PDF
Cataleg globaldis
DOC
CURSO - SEMINARIO: TERTULIAS PEDAGÓGICAS DIALÓGICAS: CONSTRUCCIÓN COLECTIVA D...
ODP
Gestion Creativa: I+D+i en Software Libre como transformador económico social
PDF
IANA Update September 2015
PDF
La electricidad y las corrientes eléctricas
PDF
gshxfj
PPT
Colt Access Solution Presentation External 12 07 2011
PDF
Bulos en internet, cómo detectarlos y cómo actuar?
PDF
Asia Frontier Capital - AFC Vietnam Fund presentation 2015.08.09
PDF
Dossier Eventos Corporativos Altacazuela
BCUR Poster
Formato 500 cartas jimenez 10a
Spice world london 2012 Ben Snape
Los conocemos mejor que tu
Local Commerce – Wird der stationäre Handel wieder eine Chance verpassen?
Cataleg globaldis
CURSO - SEMINARIO: TERTULIAS PEDAGÓGICAS DIALÓGICAS: CONSTRUCCIÓN COLECTIVA D...
Gestion Creativa: I+D+i en Software Libre como transformador económico social
IANA Update September 2015
La electricidad y las corrientes eléctricas
gshxfj
Colt Access Solution Presentation External 12 07 2011
Bulos en internet, cómo detectarlos y cómo actuar?
Asia Frontier Capital - AFC Vietnam Fund presentation 2015.08.09
Dossier Eventos Corporativos Altacazuela
Ad

Similar to REST and some Python (or 'Python "sinners" must REST') (20)

PDF
Snakes on the Web
PDF
Jim Webber A Couple Of Ways To Skin An Internet Scale Catx
PPTX
RESTful Web Services
PPTX
Scaling with swagger
PDF
Plone - A History of Python Web
PDF
Rapid Web Development with Python for Absolute Beginners
PPTX
A CMD Core Model for CLARIN Web Services
PPTX
Service stack all the things
PDF
Designing RESTful APIs
PPS
Etech2005
PPS
Web Services Mash-Up
PPTX
Digging deeper into service stack
PDF
Best Practices in Web Service Design
PPT
Dc roundtablesmall webservices_2002
PPTX
Scaling Web Services with Evolvable RESTful APIs - JavaOne 2013
PDF
Web Services Tutorial
PDF
Rest Vs Soap Yawn2289
PDF
Web Services PHP Tutorial
PDF
Adaptation in Open Source Software, PyCon 2016 Keynote
PPT
restful based web services a presentation
Snakes on the Web
Jim Webber A Couple Of Ways To Skin An Internet Scale Catx
RESTful Web Services
Scaling with swagger
Plone - A History of Python Web
Rapid Web Development with Python for Absolute Beginners
A CMD Core Model for CLARIN Web Services
Service stack all the things
Designing RESTful APIs
Etech2005
Web Services Mash-Up
Digging deeper into service stack
Best Practices in Web Service Design
Dc roundtablesmall webservices_2002
Scaling Web Services with Evolvable RESTful APIs - JavaOne 2013
Web Services Tutorial
Rest Vs Soap Yawn2289
Web Services PHP Tutorial
Adaptation in Open Source Software, PyCon 2016 Keynote
restful based web services a presentation
Ad

More from Sabin Buraga (20)

PDF
Web 2020 01/12: World Wide Web – aspecte arhitecturale
PDF
Web 2020 02/12: Programare Web – HTTP. Cookie-uri. Sesiuni Web
PDF
Web 2020 03/12: Programare Web – Arhitectura aplicaţiilor Web. Inginerie Web
PDF
Web 2020 04/12: Programare Web – Dezvoltarea aplicaţiilor Web în PHP
PDF
Web 2020 05/12: Modelarea datelor. Familia XML. Extragerea datelor cu XPath. ...
PDF
Web 2020 06/12: Procesarea datelor XML & HTML. Document Object Model
PDF
Web 2020 07/12: Procesarea datelor XML & HTML – Simple API for XML. Procesări...
PDF
Web 2020 08/12: Servicii Web. De la arhitecturi orientate spre servicii la SO...
PDF
Web 2020 09/12: Servicii Web. Paradigma REST
PDF
Web 2020 10/12: Servicii Web. Micro-servicii. Serverless. Specificarea API-ur...
PDF
Web 2020 11/12: Interacţiune Web asincronă. Aplicaţii Web de tip mash-up. JAM...
PDF
Web 2020 12/12: Securitatea aplicaţiilor Web. Aspecte esenţiale
PDF
STAW 01/12: Arhitectura aplicaţiilor Web
PDF
STAW 02/12: Programare Web: Limbajul JavaScript. Aspecte esenţiale
PDF
STAW 03/12: Programare Web: Limbajul JavaScript. Aspecte moderne: ES6 et al.
PDF
STAW 04/12: Programare Web: Node.js
PDF
STAW 05/12: Arhitectura navigatorului Web
PDF
STAW 06/12: JavaScript în navigatorul Web. De la DOM la Ajax şi mash-up-uri
PDF
STAW 07/12: Ingineria dezvoltării aplicaţiilor JavaScript
PDF
STAW 08/12: Programare Web. Suita de tehnologii HTML5
Web 2020 01/12: World Wide Web – aspecte arhitecturale
Web 2020 02/12: Programare Web – HTTP. Cookie-uri. Sesiuni Web
Web 2020 03/12: Programare Web – Arhitectura aplicaţiilor Web. Inginerie Web
Web 2020 04/12: Programare Web – Dezvoltarea aplicaţiilor Web în PHP
Web 2020 05/12: Modelarea datelor. Familia XML. Extragerea datelor cu XPath. ...
Web 2020 06/12: Procesarea datelor XML & HTML. Document Object Model
Web 2020 07/12: Procesarea datelor XML & HTML – Simple API for XML. Procesări...
Web 2020 08/12: Servicii Web. De la arhitecturi orientate spre servicii la SO...
Web 2020 09/12: Servicii Web. Paradigma REST
Web 2020 10/12: Servicii Web. Micro-servicii. Serverless. Specificarea API-ur...
Web 2020 11/12: Interacţiune Web asincronă. Aplicaţii Web de tip mash-up. JAM...
Web 2020 12/12: Securitatea aplicaţiilor Web. Aspecte esenţiale
STAW 01/12: Arhitectura aplicaţiilor Web
STAW 02/12: Programare Web: Limbajul JavaScript. Aspecte esenţiale
STAW 03/12: Programare Web: Limbajul JavaScript. Aspecte moderne: ES6 et al.
STAW 04/12: Programare Web: Node.js
STAW 05/12: Arhitectura navigatorului Web
STAW 06/12: JavaScript în navigatorul Web. De la DOM la Ajax şi mash-up-uri
STAW 07/12: Ingineria dezvoltării aplicaţiilor JavaScript
STAW 08/12: Programare Web. Suita de tehnologii HTML5

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
cuic standard and advanced reporting.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
Programs and apps: productivity, graphics, security and other tools
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
A Presentation on Artificial Intelligence
PPTX
Spectroscopy.pptx food analysis technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Approach and Philosophy of On baking technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
cuic standard and advanced reporting.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation_ Review paper, used for researhc scholars
Unlocking AI with Model Context Protocol (MCP)
Digital-Transformation-Roadmap-for-Companies.pptx
Machine learning based COVID-19 study performance prediction
A comparative analysis of optical character recognition models for extracting...
Programs and apps: productivity, graphics, security and other tools
The AUB Centre for AI in Media Proposal.docx
A Presentation on Artificial Intelligence
Spectroscopy.pptx food analysis technology
Dropbox Q2 2025 Financial Results & Investor Presentation
MIND Revenue Release Quarter 2 2025 Press Release
Approach and Philosophy of On baking technology
Assigned Numbers - 2025 - Bluetooth® Document
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 3 Spatial Domain Image Processing.pdf

REST and some Python (or 'Python "sinners" must REST')