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
82
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
32
Building Infrastructure for the Next Generation of Successful African Ventures - Africa's Talking
ianjuma
0
90
Change Management: Building a CI/CD Pipeline
ianjuma
0
130
Ian J, Salama A.B
ianjuma
0
110
Innovation
ianjuma
0
140
Asynchronous Python with gevent and asyncIO
ianjuma
1
2.5k
Scaling AfricasTalking - DevCraft nairobi
ianjuma
0
260
Other Decks in Programming
See All in Programming
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
430
The free-lunch guide to idea circularity
hollycummins
0
380
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
340
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
860
おれのAgentic Coding 2026/03
tsukasagr
1
120
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
240
テレメトリーシグナルが導くパフォーマンス最適化 / Performance Optimization Driven by Telemetry Signals
seike460
PRO
2
190
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
160
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
170
モダンOBSプラグイン開発
umireon
0
190
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
570
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.6k
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
Building AI with AI
inesmontani
PRO
1
830
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
RailsConf 2023
tenderlove
30
1.4k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
250
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
200
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Curse of the Amulet
leimatthew05
1
11k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
800
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
680
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()