Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
HTTP API & Python
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Milan Cermak
February 20, 2013
Programming
290
3
Share
HTTP API & Python
Slides from my talk at Brno and Prague Python user group meetups on HTTP/REST APIs.
Milan Cermak
February 20, 2013
More Decks by Milan Cermak
See All by Milan Cermak
Building a CI/CD pipeline on AWS
milancermak
0
7k
Designing mobile friendly APIs
milancermak
0
120
Programování pro iOS z pohledu pythonistu
milancermak
0
300
Prečo povedať nie SQL
milancermak
1
140
Other Decks in Programming
See All in Programming
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
140
The Less-Told Story of Socket Timeouts
coe401_
3
1.1k
Making the RBS Parser Faster
soutaro
0
680
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
350
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
240
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
680
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
340
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.2k
Agentic Elixir
whatyouhide
0
450
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
180
ソースコード→AST→オペコード、の旅を覗いてみる
o0h
PRO
1
130
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
160
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
240
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
560
Into the Great Unknown - MozCon
thekraken
41
2.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
110
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.9k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
160
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Being A Developer After 40
akosma
91
590k
Amusing Abliteration
ianozsvald
1
160
Transcript
HTTP API & Py Milan Čermák Pyvo Praha, 20. 2.
2013 Wednesday, February 20, 13
What makes a good API? Wednesday, February 20, 13
Wednesday, February 20, 13
Consistency Wednesday, February 20, 13
Consistency Predictability Wednesday, February 20, 13
Consistency Predictability Adherence to standards Wednesday, February 20, 13
Consistency Predictability Adherence to standards Great documentation Wednesday, February 20,
13
Why HTTP? Wednesday, February 20, 13
"While HTTP isn’t always the best answer, it’s a damn
fine first guess." Coda Hale Wednesday, February 20, 13
Benefits of HTTP Wednesday, February 20, 13
Benefits of HTTP The most widespread application protocol Wednesday, February
20, 13
Benefits of HTTP The most widespread application protocol Statelessness Wednesday,
February 20, 13
Benefits of HTTP The most widespread application protocol Statelessness Optional
caching Wednesday, February 20, 13
Benefits of HTTP The most widespread application protocol Statelessness Optional
caching Promotes layered infrastructure Wednesday, February 20, 13
Benefits of HTTP The most widespread application protocol Statelessness Optional
caching Promotes layered infrastructure etc. Wednesday, February 20, 13
Limitations of HTTP Wednesday, February 20, 13
Limitations of HTTP Authorization Wednesday, February 20, 13
Limitations of HTTP Authorization Statelessness Wednesday, February 20, 13
Limitations of HTTP Authorization Statelessness Verbosity Wednesday, February 20, 13
Limitations of HTTP Authorization Statelessness Verbosity Crippled parallelism Wednesday, February
20, 13
"REST" if protocol.startswith("http") else "you're doing it wrong" Wednesday, February
20, 13
Set of architectural constraints Wednesday, February 20, 13
Set of architectural constraints Client-server Wednesday, February 20, 13
Set of architectural constraints Client-server Stateless Wednesday, February 20, 13
Set of architectural constraints Client-server Stateless Cacheable Wednesday, February 20,
13
Set of architectural constraints Client-server Stateless Cacheable Layered Wednesday, February
20, 13
Set of architectural constraints Client-server Stateless Cacheable Layered Uniform interface
* Wednesday, February 20, 13
How can Python help? Wednesday, February 20, 13
OOP Wednesday, February 20, 13
OOP URI ~ Class handler mapping Wednesday, February 20, 13
import handlers urls = [(r"/user", handlers.users.NewUser), (r"/user/(\d+)", handlers.users.User)] class User(handler.base.BaseHandler):
def delete(self, user_id): pass def get(self, user_id): pass def post(self, user_id): pass Wednesday, February 20, 13
class UserValidatorMixin(object): def check_user_data(self, user_dict): pass class User(handler.base.BaseHandler, UserValidatorMixin): def
post(self, user_id): new_user = self.get_argument(“user”) if not self.check_user_data(new_user): return self.http_error(400, “Invalid data”) Wednesday, February 20, 13
Middleware Wednesday, February 20, 13
Wednesday, February 20, 13
Extending JSONEncoder Wednesday, February 20, 13
import json class AppJSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, User):
return {"name": obj.name, "height": obj.height, "cash": obj.get_bank_account_balance()} return json.JSONEncoder.default(self, obj) user = User("1337") json.dumps(user, cls=AppJSONEncoder) Wednesday, February 20, 13
What about mobile? Wednesday, February 20, 13
Compression of HTTP bodies GET /user/1337 HTTP/1.1 Host: api.napyvo.io Accept-Encoding:
gzip, identity Wednesday, February 20, 13
Compression of HTTP bodies HTTP/1.1 200 OK Content-Encoding: gzip Content-Type:
application/json; charset=utf-8 Wednesday, February 20, 13
Compression of HTTP bodies POST /user HTTP/1.1 Host: api.napyvo.io Content-Encoding:
gzip Content-Type: application/json [gzipped representation of a user] Wednesday, February 20, 13
Caching Cache-Control: max-age=3600 Expires: Thu, 31 Jan 2013 22:00:00 GMT
<- Last-Modified: Thu, 31 Jan 2013 18:30:00 GMT -> If-Modified-Since: Wed, 30 Jan 2013 13:37:00 GMT ETag: foo If-None-Match: foo Wednesday, February 20, 13
Partial resources Wednesday, February 20, 13
GET /car/9 {"car": { "color": "red", "passengers": [ {"href": "/user/1337",
"rel": "self"}] } } Wednesday, February 20, 13
GET /car/9?zoom=passengers {"car": { "color": "red", "passengers": [ {"href": "/user/1337",
"rel": "self", "name": "Milan", "drink": "beer", "skills": ["python", "http"], }] } } Wednesday, February 20, 13
The promise of Hypermedia Wednesday, February 20, 13
Hypermedia as the engine of application state Wednesday, February 20,
13
Q & A Wednesday, February 20, 13