Official documentation: Multipart Forms
Install Falcon (3.0+ required for ASGI) and the
uvicorn
ASGI app server:pip install -U "falcon >= 3.0.0" pip install uvicorn
import logging | |
from weakref import WeakKeyDictionary | |
import nameko | |
from nameko.extensions import DependencyProvider | |
import sentry_sdk | |
from sentry_sdk import Hub | |
from sentry_sdk.utils import event_from_exception | |
logger = logging.getLogger("workers") |
import os | |
import arel | |
from fastapi import FastAPI, Request | |
from fastapi.templating import Jinja2Templates | |
app = FastAPI() | |
templates = Jinja2Templates("templates") | |
if _debug := os.getenv("DEBUG"): |
Official documentation: Multipart Forms
Install Falcon (3.0+ required for ASGI) and
the uvicorn
ASGI app server:
pip install -U "falcon >= 3.0.0" pip install uvicorn
$ uname -r
*.pyc |
from flask import Flask, request | |
from nameko.standalone.rpc import ServiceRpcProxy | |
app = Flask(__name__) | |
@app.route('/') | |
def task_list(): | |
return """ | |
<html> |
class AllowPUTAsCreateMixin(object): | |
""" | |
The following mixin class may be used in order to support PUT-as-create | |
behavior for incoming requests. | |
""" | |
def update(self, request, *args, **kwargs): | |
partial = kwargs.pop('partial', False) | |
instance = self.get_object_or_none() | |
serializer = self.get_serializer(instance, data=request.data, partial=partial) | |
serializer.is_valid(raise_exception=True) |
# MAC manipulators | |
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`' | |
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE' |