Python client library for actions on google
Project description
aog
===
A simple and easy to use python client library for Actions on google webhook.
Installation
============
Fast install:
```
pip install aog
```
Example
=======
```python
import json
import os
from flask import Flask
from flask import request
from flask import make_response
from aog import conv
# Flask app should start in global layout
app = Flask(__name__)
@app.route('/', methods=['POST'])
def fullfillment():
req = request.get_json(silent=True, force=True)
print("Request:")
print(json.dumps(req, indent=4))
res = makeFullfillment(req)
res = json.dumps(res, indent=4)
#print(res)
final = make_response(res)
final.headers['Content-Type'] = 'application/json'
return final
def makeFullfillment(req):
# Wrte your python code here
#isfrom function is used to check from which dialogflow intent request came from.
if conv.isfrom(req,'ask_intent'):
# ask method expect a reply from user. after the message mic will be open for user to reply.
res=conv.ask("You made me ask this","You made me print this")
return res
# F I N A L R E S P O N S E
if conv.isfrom(req,'final response'):
# Close is for terminating the conversation with a message.
res=conv.close('Closing')
return res
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aog-1.0.0.tar.gz
(4.3 kB
view details)
Built Distribution
aog-1.0.0-py3-none-any.whl
(4.5 kB
view details)
File details
Details for the file aog-1.0.0.tar.gz
.
File metadata
- Download URL: aog-1.0.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e19d739563bfaff33dcd61b71879c5078eed0ba6d2f6bc5dd46dd2c8de24e51c
|
|
MD5 |
cefea9e298f15bc40582cfefb45f9696
|
|
BLAKE2b-256 |
cc6a7a9e5a002916b4ac5eb78cd4163d3a37a2da18e0720df5bd5e802f626010
|
File details
Details for the file aog-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: aog-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
fc938e8898a228f25c7fc25ebec7bc3328e4420dd16ef7cada20b854218b0f15
|
|
MD5 |
748c0a7f2e340f7a9d56261e8158ba5b
|
|
BLAKE2b-256 |
06fcd617c6ba98b263b016ee8263361f1723620a977df150340d48b55a25f3e9
|