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
77
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
30
Building Infrastructure for the Next Generation of Successful African Ventures - Africa's Talking
ianjuma
0
89
Change Management: Building a CI/CD Pipeline
ianjuma
0
120
Ian J, Salama A.B
ianjuma
0
110
Innovation
ianjuma
0
140
Asynchronous Python with gevent and asyncIO
ianjuma
1
2.4k
Scaling AfricasTalking - DevCraft nairobi
ianjuma
0
260
Other Decks in Programming
See All in Programming
OSS開発者という働き方
andpad
5
1.7k
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
140
「手軽で便利」に潜む罠。 Popover API を WCAG 2.2の視点で安全に使うには
taitotnk
0
870
Deep Dive into Kotlin Flow
jmatsu
1
370
ぬるぬる動かせ! Riveでアニメーション実装🐾
kno3a87
1
230
より安全で効率的な Go コードへ: Protocol Buffers Opaque API の導入
shwatanap
2
790
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
2.1k
プロパティベーステストによるUIテスト: LLMによるプロパティ定義生成でエッジケースを捉える
tetta_pdnt
0
4.3k
楽して成果を出すためのセルフリソース管理
clipnote
0
190
意外と簡単!?フロントエンドでパスキー認証を実現する WebAuthn
teamlab
PRO
2
780
AIでLINEスタンプを作ってみた
eycjur
1
230
1から理解するWeb Push
dora1998
7
1.9k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Balancing Empowerment & Direction
lara
3
630
Being A Developer After 40
akosma
90
590k
Raft: Consensus for Rubyists
vanstee
140
7.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
GitHub's CSS Performance
jonrohan
1032
460k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
Navigating Team Friction
lara
189
15k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
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()