I’m currently serving up files using a static route like so: application.add_static_route(‘/artifacts/’, ‘/artifacts/’) How can I add a function that is called before every GET to this route and any route below it? I’d like to send some data to our matomo (analytics) server when any user tries to grab an artifact from that route. ..
My Falcon based ASGI app is executed via Daphne and works fine when it is run locally and accessed via localhost. The app is packaged in a container and run in a K8s cluster behind an Ingress. On K8s the app is not running at the root of the domain, but in a /sub/folder. This ..
This week I used FastAPI and Uvicorn to make SQL requests inside my database and it all went well. I can select, insert, inpute and delete inside my database from my localhost page. Here’s my code for your information. This is all working: from __future__ import print_function from fastapi import FastAPI import psycopg2 app = ..
I’m using selenium to make a headless scraping of a website within an endpoint of an API using Flask for Python. I made several tests and my selenium scraping code works perfectly within a script and while running as an API in the localhost. However, when I deploy the code in a remote server, the ..
I set up a very basic Python API server with falcon along the example given in the documentation. And it seems to work just fine. Now I extended the code to support HTTPS requests using SSL certificates import ssl httpd = simple_server.make_server(”, 8000, app) httpd.socket = ssl.wrap_socket( httpd.socket, server_side=True, certfile=’cert.pem’, keyfile=’key.pem’) httpd.serve_forever() And again, it ..
I am pretty new to integration testing and falcon framework and having hard time to implement integration test for my apis. I have been trying to use sqllite to create a fixture data and use it instead of my database whenever i simulate a request to the actual endpoint. I’m using TestBase from falcon.testing and ..
I install python package using the system package manager: apk add py3-gunicorn Then I create and fill venv with falcon: python3 -mvenv –system-site-packages . . ./bin/activate pip3 install falcon No errors so far. But when I try to actually run my application, I get following error: [2021-07-25 14:36:37 +0000]  [INFO] Starting gunicorn 20.0.4 [2021-07-25 ..
I am getting this error: No module named ‘falcon.api’. I have tried the docs but that didn’t help. imported packages from fastapi import APIRouter, Depends, Response from falcon.api import Policy from falcon.types import API method @ROUTER.get(‘/policy’, tags=["policy api"]) def get_policy(response: Response, auth: Token = Depends(token)): ”’ Call the policy API to get a policy ”’ ..
I’m writing a backend using falcon and celery, and I multiple endpoints with the same logic with various objects, one of the endpoints should run synchronously with the same flow. The flow is built from several chains with link_error when something terrible happens and triggers another task to finish gracefully. If the chain run successfully, ..
Just to give a brief introduction, I am using elastic beanstalk from Amazon to deploy my python (Falcon) application. I have two environments of elastic beanstalk (one being the main app server and the other one a worker environment). The worker environment receives HTTP requests for async tasks and then executes them. Most of the ..