June 2019
Beginner to intermediate
770 pages
19h 24m
English
Before looking at a smarter REST server application, we'll look at writing a REST client. The standard library has two packages useful for creating a client: http.client and urllib. These packages both provide features required to make RESTful requests over HTTP. Both packages include features to create requests with bodies, include headers, add complex URLs and retrieve a result, save the result headers, save any attachments, and track the status code. A popular alternative to urllib is the requests package. For further information, check out http://docs.python-requests.org/en/master/.
You can get the Open API specification with the following simple code:
import requestsget_openapi = requests.get( "http://127.0.0.1:5000/openapi.json" ...
Read now
Unlock full access