Why does my JavaScript code receive a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error, while Postman does not?

Mod note: This question is about why XMLHttpRequest/fetch/etc. on the browser are subject to the Same Access Policy restrictions (you get errors mentioning CORB or CORS) while Postman is not....

Custom error message json object with flask-restful

It is easy to propagate error messages with flask-restful to the client with the abort() method, such as abort(500, message="Fatal error: Pizza the Hutt was found dead earlier today in the back...

Flask - access the request in after_request or teardown_request

I want to be able to access the request object before I return the response of the HTTP call. I want access to the request via "teardown_request" and "after_request": from flask import...

TypeError: key <built-in function id> is not a string

I am using flask and its flask-restful extension to make a simple restful-api. I am having trouble stuffing data into Question table with User id (reference). The model.py file is the...

python-flask Nomodule named 'flask_nav'

Actually I am learning python flask Navigation, I installed all the necessary packages successfully, these are some of the packages, app$ venv/bin/easy_install flask-restful app$...

Flask API TypeError: Object of type 'Response' is not JSON serializable

i have a problem with Python Flask Restful API and data goes to Elasticsearch, when i post a new data with Postman, problem is: TypeError: Object of type 'Response' is not JSON serializable Can...

Python - How to run multiple flask apps from same client machine

I have one flask application script as given below : from flask import Flask app = Flask(__name__) @app.route("/<string:job_id>") def main(job_id): return "Welcome!. This is Flask Test Part...

Python: Where is the object getting instantiated and how can I pass arguments during object creation?

I'm building a RESTful API using Python Flask and flask-restplus. It is a scaled flask-restplus application and I followed the page (Scaling your project) given here to design my application. I...

Consume Flask video streaming with ffmpeg

I've created a python Flask video file streamer resource that works well when getting the file in a web browser but is not working when using ffmpeg. The flask resource is: from flask_restful...

How to use Keycloak with Flask REST API Service

I am trying to implement the Keycloak to my Flask Rest Service but it always gives below error. {"error": "invalid_token", "error_description": "Token required but invalid"} client_secrets.json ...

When would I use an external serializer like marshmallow over monogoengine's in-built JSON serialization (from_json and to_json)?

I am writing a simple REST API in Python using Flask-RESTful and their documentation says that they are planning to deprecate their object serialization (reqparse) in favor of serializers like...

POST /api/sendimage 400 (BAD REQUEST) Flask restful API from browser

I am using Python 3.6.3 Flask==1.0.2 Flask-Cors==3.0.7 Flask-RESTful==0.3.7 for making an API which is used to collect tiff image using post method and save it locally. api = Api(app) CORS(app) ...

How to receive values from a AJAX GET call in flask restful?

I am running a flask restful API, for weather prediction, flask_rest.py and a web app to consume the API named main.py. I am trying to display the output using AJAX in a HTML file named...

"Missing CSRF token in headers" with JWT authentication in Flask-Admin

I am writing a Flask backend to serve a RESTful API with authentication through JWT. I am using Flask-Admin for the admin and, in order to use a single authentication method, I would like to use...

How to define the same field for load_only and dump_only params at the Marshmallow scheme?

I am trying to build a marshmallow scheme to both load and dump data. And I get everything OK except one field. For load data its type is Decimal. And I used it like this before. Now I want to use...

flask run does not work when using flask restplus

I am new to python and flask. I want to use flask-restplus. On using flask restplus, I am unable to start my app with "flask run" command. However, it does start when I run it as module "python3...

how to fix Flask RESTful api server endpoint failing problem?

I am new to api development using openapi sepc, so I followed this blog where I just used server artifact to understand the code. I used /openapi/photo_album/codegen_server for my simple work. To...

No module named 'application' Error while deploying simple web app to Elastic Beanstalk

I am deploying a web app to elastic beanstalk using this tutorial and the same 'application.py' file they have:...

How to use multiple User Classes in flask login?

I am creating a Flask app in which 2 types of users can register and log in. In the @login.user_loader function, how can I configure it to check different tables based on the type of user that is...

Trying to send form data from React.js form to Flask API, yet it doesn't allow to submit to MongoDB

I am trying to make a simple create-User form in order to understand the functions of the API using react.js, python(Flask) and mongodb. However, I keep getting error that none of the input are...

Deploy flask api on IIS server gives error 0x8007010b notification: ExecuteRequestHandler

I have to deploy flask app on IIS server. configured the handler settings and also configured the fastcgi module settings for IIS server as given in the following tutorial...

Fatal error in launcher: when using flask run

I have instantly got into this error without changing any file or configuration related to the file but when I got into my API folder in order to run my backend server F:\projects\scl\api>venv ...

When FLASK_ENV=development, Werkzeug does not log HTTP requests

I am working on a simple Flask-RESTful API, which I am very new at, and have run into some problems with logging. With export FLASK_ENV=development, the Werkzeug logger does not log any HTTP...

TypeError: Object of type function is not JSON serializable when using flask_jwt_extended int RESTful API

I'm building a REST API using flask. I'm using postman for testing a route that creates a new item in my database, but only if the user is logged in. The routes for registering and login are...

Marshmallow returning empty JSON after dumping

I am trying to implement a restful API with Flask using flask-restful, flask-sqlalchemy and flask-marshmallow. I am aware there are many questions about this issue but I still can't figure it...

cannot import name '_endpoint_from_view_func' from 'flask.helpers' in python

I ran the same code on Ubuntu with no problem, but ran it on Windows10 with problems. I also installed Flask. My windows environment is configured as follows: $ pip --version pip 21.1.1 from...

Is it possible to use Flask RestX wih Flask's 2.0+ async await?

Usage of async/await was presented in Flask 2.0. (https://flask.palletsprojects.com/en/2.0.x/async-await/) I am using Flask-RestX so is it possible to use async/await in RestX requests...

Working with Flask Request Context for user management

I am currently working on a project where I am building an API using Flask, Flask-RESTful, and then Auth0 for user authentication. Currently, I am wrestling with passing the Auth0 sub id from the...

How to use Marshmallow Schema in Flask-restx Swagger UI Automatically

I'm trying to create a restful web services with flask-restx and marshmallow. I'm using marshmallow for both request and response validations. Since flask-restx api docs does not support...

Flask SQLAlchemy and Blueprints

I am still learning flask and I have created an restful API with SQLAlchemy. The app is getting to be big and I would like to split it up into multiple files. When I separate the routes section...