...
Icon | Description |
---|---|
Python Project, Python External Library | |
Python Module | |
Python Class | |
Python Method | |
Python Script | |
Python GET (urllib, urllib2, httplib, httplib2, aiohttp) service | |
Python POST (urllib, urllib2, httplib, httplib2, aiohttp) service | |
Python PUT (urllib, urllib2, httplib, httplib2, aiohttp) service | |
Python DELETE (urllib, urllib2, httplib, httplib2, aiohttp) service | |
Python Query, Python ORM Mapping, Python File Query | |
RabbitMQ Python QueueCall | |
RabbitMQ Python QueueReceive | |
Python Call To Java Program | |
Python Call To Generic Program | |
Amazon Web Services | |
Python Call to AWS Lambda Function | |
Python Callo Call to Unknown AWS Lambda Function | |
Python AWS Lambda GET Operation | |
Python AWS Lambda POST Operation | |
Python AWS Lambda PUT Operation | |
Python AWS Lambda DELETE Operation | |
Python AWS Lambda ANY Operation | |
Python AWS SQS Publisher, Python AWS SNS Publisher | |
Python AWS SQS Receiver, Python AWS SNS Receiver | |
Python AWS SQS Unknown Publisher, Python AWS SNS Unknown Publisher | |
Python AWS SQS Unknown Receiver, Python AWS SNS Unknown Receiver | |
Python Email, Python SMS |
...
Code Block | ||
---|---|---|
| ||
import aiohttp
session = aiohttp.ClientSession()
res = session.get('https://api.github.com/events') |
The aiohttp module can be also used in server mode, implementing web service operations
...
Code Block | ||
---|---|---|
| ||
from flask.views import MethodView class InformationAPI(MethodView): def get(self): information = Information.from_data(request.data) ... app.add_url_rule('/<info>/informations/', view_func=InformationAPI.as_view('informations')) |
falcon
NOTE: Support for Falcon is expected to be released in 1.4.0-beta6.
Falcon route annotations for web service operations (GET, PUT, POST, DELETE) are supported.
In the following example, a default GET operation is ascribed to the functionon_get from GetResourceclass,and the POST and PUT operations to the on_putandon_postfunctions fromPut_PostResourcewith two differents urls routing:
The link between the GET operation named after the routing URL "/" and the called functionon_get is represented by an arrow pointing to the function:
The name of a saved Web Service Operation object will be generated from the routing URL by adding a final slash when not present. In this example the name of the POST operations is "/url/example/1/" and "/url/example/2/" after the routing url "/url/example/1" and "/url/example/2".
Sinks are supported with the following rules : If no route matches a request, but the path in the requested URI matches a sink prefix, Falcon will pass control to the associated sink, regardless of the HTTP method requested. If the prefix overlaps a registered route template, the route will take precedence and mask the sink.
In this case Web Service Operation objects generated as sinks will be named as/that/, and not as/this/since another Web Service Operation object exists with an overlapping url.
Code Block | ||
---|---|---|
| ||
importfalcon app=falcon.App() class GetResource(): def on_get(): print('on_get function') def sink_method(resp,**kwargs): resp.body="Sink" pass app.add_route('this/is/the/way', GetResource()) app.add_sink(sink_method, prefix='/that') # get, post, put & delete routes will be created and linked to sink_method app.add_sink(sink_method, prefix='/this') # no routes created because Url overlaps another route |
The optional suffix keyword argument of Falcon add_route is supported. In this way, multiple closely-related routes can be mapped to the same resource.
...