When I am trying to post the file that I have received from a post request, it is giving me an error as:
expected str, bytes or os.PathLike object, not FileStorage
How am I suppose to post the file? A proper syntax is what I am looking for. However without posting file, that is only posting data is working fine.
from PIL import Image
from flask_restful import Resource, request, Api
import requests
class fileSendingApi(Resource):
def post(self):
images=open(request.files['my_image_1'],'rb')
URL = 'http://127.0.0.1:5000/final_img_api'
file={"my_image_2": images}
values={"auth_key": "some_auth_key"}
response = requests.post(URL, files=file, data=values)
output = response.json()