Package for implementing Dorset remote agent API
Project description
Dorset remote agent library
This library provides components for implementing the remote agent web service API for Dorset conversational interface project.
Installation
Install using pip:
$ pip install dorset
Usage
This library handles the encoding and decoding of requests and responses from a Dorset application. This supports the creation of remote agents written in Python. Use this library with a python framework for RESTful APIs like Flask, Bottle, or Django.
The web framework will handle HTTP requests and response and this library will decode the request as an AgentRequest object and will encode an AgentResponse.
With Flask, this will look like:
app = Flask("dorset_hello")
# required endpoint for the application to test if the agent is alive
@app.route('/ping', methods=['GET'])
def ping():
return json.dumps("pong")
# primary endpoint
@app.route('/request', methods=['POST'])
def process():
agent_request = Dorset.decode_request(request.data)
print(agent_request.text)
return Dorset.encode_response(text="hello, world!")
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
File details
Details for the file dorset-0.4.0.tar.gz
.
File metadata
- Download URL: dorset-0.4.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1183c007bf2dde8260a74ae21cf966f7abab81108561d7479b4b6c753dc8ad76 |
|
MD5 | e65f7478e02433b739bde0fe15d03f41 |
|
BLAKE2b-256 | d8ea8e0a8e43f946b1ce4bd27a8334163cb592b4c6e0873ef72a56605066749d |