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
88
0
Share
Intro to Flask and AT API's
Flask introduction; AfricasTalking API's introduction
Ian Juma
October 15, 2016
More Decks by Ian Juma
See All by Ian Juma
Scaling notifications; notification-service V2
ianjuma
0
35
Building Infrastructure for the Next Generation of Successful African Ventures - Africa's Talking
ianjuma
0
92
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
20年以上続くプロダクトでも使い続けられる静的解析ツールを求めて
matsuo_atsushi
0
140
AI時代だからこそ「Bloc」を採用する価値があるのかもしれない
takuroabe
0
140
Explore CoroutineScope
tomoeng11
0
180
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
350
Liberating Ruby's Parser from Lexer Hacks
ydah
2
2.7k
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
1.1k
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
2.7k
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
170
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
580
ハーネスエンジニアリングとは?
kinopeee
13
6.9k
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.6k
Road to RubyKaigi: Play Hard(ware)
makicamel
1
560
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.6k
Automating Front-end Workflow
addyosmani
1370
200k
How to build a perfect <img>
jonoalderson
1
5.5k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Context Engineering - Making Every Token Count
addyosmani
9
870
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
What's in a price? How to price your products and services
michaelherold
247
13k
From π to Pie charts
rasagy
0
180
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
910
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
It's Worth the Effort
3n
188
29k
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()