python - Unsupported Media type, backend, Please guide me -


i trying receive pdf file using falcon framework backend. beginner @ backend , trying understand happening. summary, there 2 classes. 1 of them, friends working.

this backend side code:

#this code class vehiclepolicyresource(object):     def on_post(self, req, resp, reg):         local_path = create_local_path(req.url, req.content_type)         open(local_path, 'wb') temp_file:             body = req.stream.read()             temp_file.write(body) #this friend code class vehicleodometerresource(object):     def on_post(self, req, resp, reg):         local_path = create_local_path(req.url, req.content_type)         open(local_path, 'wb') temp_file:             body = req.stream.read()             temp_file.write(body) 

it same , did not give same answer , add route doing api.add_route('/v1/files/{reg}/policies',vehicleresourcesv1.vehiclepolicyresource())

and using command in terminal : http post localhost:5000/v1/files/sjq52883y/policies@/users/alfreddatui/autoarmour/aa-atlas/static/asd.pdf trying file. keep saying, unsupported media type. while other code, receiving image, literally same code above, works.

any idea ?

i got it, notice falcon default receive json file(please correct me if wrong) need make exception pdf , image file.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -