Preferred File Location
/var/www/html
Assign www-data
as owner
sudo chown www-data:www-data /var/www/html/error.html
import logging | |
from http import HTTPStatus | |
import httpx | |
import uvicorn.logging | |
from fastapi import FastAPI, HTTPException, Request, Response | |
from fastapi.routing import APIRoute | |
TARGET_URL = "http://127.0.0.1:8080" # Change this to the URL you want to proxy requests to | |
CLIENT = httpx.Client() |
import logging | |
from http import HTTPStatus | |
import httpx | |
import uvicorn.logging | |
from fastapi import FastAPI, HTTPException, Request, Response | |
from fastapi.routing import APIRoute | |
TARGET_URL = "http://127.0.0.1:8080" # Change this to the URL you want to proxy requests to |
Preferred File Location
/var/www/html
Assign www-data
as owner
sudo chown www-data:www-data /var/www/html/error.html
import math | |
import os | |
import time | |
from threading import Thread | |
from typing import Union | |
import inflect | |
import requests | |
import tqdm |
import functools | |
import time | |
def timed_cache(max_age, maxsize=128, typed=False): | |
"""Least-recently-used cache decorator with time-based cache invalidation. | |
See Also: | |
- ``lru_cache`` takes all params of the function and creates a key | |
- If even one key is changed, it will map to new entry thus refreshed. |
import os | |
import shutil | |
import subprocess | |
import time | |
with open('requirements.txt') as file: | |
requirements = file.readlines() | |
tmp_name = f'requirements_{int(time.time())}.txt' | |
os.rename('requirements.txt', tmp_name) |
import logging | |
import math | |
import pyaudio | |
_logger = logging.getLogger(__name__) | |
_logger.addHandler(logging.StreamHandler()) | |
_logger.setLevel(logging.DEBUG) | |
import os | |
from typing import List | |
import requests | |
SESSION = requests.Session() | |
headers = { | |
'Accept': 'application/vnd.github+json', | |
'Authorization': f"Bearer {os.getenv('GIT_TOKEN')}", |
import asyncio | |
from typing import Dict | |
from urllib.parse import urljoin | |
import aiohttp | |
from pydantic import HttpUrl | |
from pydantic_settings import BaseSettings | |
class Settings(BaseSettings): |