Python Flask

From UVOO Tech Wiki
Jump to navigation Jump to search

Quick Getting Started

Example

Error Messaging in Rest API

http://flask.pocoo.org/docs/1.0/patterns/apierrors/

Testing

http://flask.pocoo.org/docs/1.0/testing/

Resources

Recaptcha

https://flask-wtf.readthedocs.io/en/stable/form.html#recaptcha

With PATCH requests you retrieve request data the same way you do for every other request type (e.g. POST). Depending on how you send your data, there are several ways to retrieve it:

Sending as application/json:

data = request.json
Sending as application/x-www-form-urlencoded (form data)

data = request.form
Sending as raw body with no Content-Type header:

data = request.data
The last one will give you a bytes string that you will then have to process accordingly. For your use case I suggest using the first example and add a Content-Type: application/json header when you send your PATCH request.