October 2019
Intermediate to advanced
426 pages
10h 8m
English
We are going to allow the clients of this endpoint to upload images using Base64 encoding. With Base64 encoding, we can translate binary data, such as image and audio, into ASCII string format and back. This method allows our application to upload images using the JSON payload in the HTTP request. Don't worry, you don't need to be familiar with Base64 to continue with the project implementation.
Let's have a look at the code of our endpoint function:
import base64import json...@app.route('/images', methods = ['POST'], cors = True)def upload_image(): """processes file upload and saves file to storage service""" request_data = json.loads(app.current_request.raw_body) file_name = request_data['filename'] file_bytes ...
Read now
Unlock full access