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
Intro to Flask and AT API's
Search
Ian Juma
October 15, 2016
Programming
0
76
Intro to Flask and AT API's
Flask introduction; AfricasTalking API's introduction
Ian Juma
October 15, 2016
Tweet
Share
More Decks by Ian Juma
See All by Ian Juma
Scaling notifications; notification-service V2
ianjuma
0
29
Building Infrastructure for the Next Generation of Successful African Ventures - Africa's Talking
ianjuma
0
87
Change Management: Building a CI/CD Pipeline
ianjuma
0
120
Ian J, Salama A.B
ianjuma
0
100
Innovation
ianjuma
0
140
Asynchronous Python with gevent and asyncIO
ianjuma
1
2.4k
Scaling AfricasTalking - DevCraft nairobi
ianjuma
0
250
Other Decks in Programming
See All in Programming
生成AI時代のコンポーネントライブラリの作り方
touyou
1
290
Rails Frontend Evolution: It Was a Setup All Along
skryukov
0
280
DMMを支える決済基盤の技術的負債にどう立ち向かうか / Addressing Technical Debt in Payment Infrastructure
yoshiyoshifujii
3
410
レベル1の開発生産性向上に取り組む − 日々の作業の効率化・自動化を通じた改善活動
kesoji
0
300
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
880
Goで作る、開発・CI環境
sin392
0
260
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
270
可変変数との向き合い方 $$変数名が踊り出す$$ / php conference Variable variables
gunji
0
180
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
260
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
680
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
140
NPOでのDevinの活用
codeforeveryone
0
900
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Navigating Team Friction
lara
187
15k
How to Think Like a Performance Engineer
csswizardry
25
1.7k
Faster Mobile Websites
deanohume
308
31k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
990
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
Bash Introduction
62gerente
613
210k
RailsConf 2023
tenderlove
30
1.1k
Code Review Best Practice
trishagee
69
19k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
108
19k
Transcript
API’s with Flask Python, Flask, API’s, AT API’s
whoami @IanJuma github.com/ianjuma medium.com/@IanJuma
API
What’s an API A contract between two pieces of software
or services
Setup Python 2.7 / 3. PIP Flask ngrok (local tunneling)
Sample project
Why Flask Simple Un-opinionated Minimal 100% WSGI Lots of extensions
Class based views
Flask API from flask import Flask app = Flask(__name__) @app.route("/api")
def resource(): # perform task return "resource" if __name__ == "__main__": app.run()
API methods from flask import Flask app = Flask(__name__) @app.route("/api”,
methods=[’POST’, ‘GET’, ‘DELETE’, ‘PUT’]) def resource(): # perform task return "resource" if __name__ == "__main__": app.run()
methods... GET - fetch a resource POST - add a
resource DELETE - remove a resource PUT - update a resource HEAD - fetch information about a resource without fetching the resource (options)
Library text API from flask import Flask app = Flask(__name__)
@app.route("/library/api") def resource(): # fetch text from harry potter return harry_potter if __name__ == "__main__": app.run()
Code ... Deep dive
Send SMS from AfricasTalkingGateway import AfricasTalkingGateway # gateway instance gateway
= AfricasTalkingGateway(username, apikey) # send message gateway.sendMessage("+254 703567XXX", "hello...")
Send Airtime from AfricasTalkingGateway import AfricasTalkingGateway # gateway instance gateway
= AfricasTalkingGateway(username, apikey) # send message gateway.sendAirtime("+254 703567XXX", "amount")
Making a voice call gateway = AfricasTalkingGateway(username, apikey) results =
gateway.call(callFrom, callTo)
Handling a call from flask import Flask app = Flask(__name__)
@app.route("/voice/api") def voice(): res = '<Response><Say>"hi, I am testing"</Say></Response>' return res if __name__ == "__main__": app.run()