repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
falcon
tests/asgi/test_asgi_helpers.py
.py
import inspect from falcon.asgi import _asgi_helpers class IntricateApp: def unorthodox_call(self, scope, receive, send): return self._call_factory(scope, receive, send) async def _call_factory(self, scope, receive, send): await send('Hello!') await send('Bye.') __call__ = _asgi...
33
738
falcon
tests/asgi/test_testing_asgi.py
.py
import time import pytest import falcon from falcon import testing from . import _asgi_test_app @pytest.mark.slow async def test_asgi_request_event_emitter_hang(): # NOTE(kgriffs): This tests the ASGI server behavior that # ASGIRequestEventEmitter simulates when emit() is called # again after there...
174
4,761
falcon
tests/asgi/test_sse.py
.py
import asyncio import json import sys import pytest import falcon from falcon import testing from falcon.asgi import App from falcon.asgi import SSEvent def test_no_events(): class Emitter: def __aiter__(self): return self async def __anext__(self): raise StopAsyncIterat...
319
8,528
falcon
tests/asgi/test_hello_asgi.py
.py
import io import os import tempfile import pytest import falcon from falcon import testing import falcon.asgi try: import aiofiles except ImportError: aiofiles = None # type: ignore[assignment] SIZE_1_KB = 1024 @pytest.fixture def client(): return testing.TestClient(falcon.asgi.App()) class DataRea...
394
12,178
falcon
tests/asgi/test_cythonized_asgi.py
.py
import sys import time import pytest import falcon from falcon import testing import falcon.asgi from falcon.util import is_python_func try: import pyximport pyximport.install() except ImportError: pyximport = None # NOTE(kgriffs): We do this here rather than inside the try block above, # so that we ...
135
3,679
falcon
tests/asgi/test_boundedstream_asgi.py
.py
import os import pytest import falcon from falcon import asgi from falcon import testing @pytest.mark.parametrize( 'body', [ b'', b'\x00', b'\x00\xff', b'catsup', b'\xde\xad\xbe\xef' * 512, testing.rand_string(1, 2048), os.urandom(100 * 2**20), ], ...
319
8,436
falcon
tests/asgi/test_buffered_reader.py
.py
import io import pytest import falcon from falcon.asgi import reader from falcon.errors import OperationNotAllowed async def async_iter(data): for item in data: yield item def async_take(source, count=None): async def collect(): result = [] async for item in source: res...
384
9,348
falcon
tests/asgi/test_request_context_asgi.py
.py
import pytest from falcon.asgi import Request import falcon.testing as testing class TestRequestContext: def test_default_request_context( self, ): req = testing.create_asgi_req() req.context.hello = 'World' assert req.context.hello == 'World' assert req.context['hell...
52
1,652
falcon
tests/asgi/test_scheduled_callbacks.py
.py
import asyncio from collections import Counter import time import pytest from falcon import testing from falcon.asgi import App @pytest.mark.slow def test_multiple(): class SomeResource: def __init__(self): self.counter = Counter() async def on_get(self, req, resp): asyn...
149
3,963
falcon
tests/asgi/test_response_media_asgi.py
.py
import json import pytest import falcon from falcon import errors from falcon import media from falcon import testing import falcon.asgi @pytest.fixture(scope='session') def msgpack(): return pytest.importorskip('msgpack') def create_client(resource, handlers=None): app = falcon.asgi.App() app.add_rou...
301
8,173
falcon
tests/asgi/test_middleware_asgi.py
.py
import pytest import falcon class MiddlewareIncompatibleWithWSGI_A: async def process_request(self, req, resp): pass class MiddlewareIncompatibleWithWSGI_B: async def process_resource(self, req, resp, resource, params): pass class MiddlewareIncompatibleWithWSGI_C: async def process_re...
35
816
falcon
tests/asgi/test_request_asgi.py
.py
import pytest from falcon import testing from falcon.asgi import Request def test_missing_server_in_scope(): req = testing.create_asgi_req(include_server=False, http_version='1.0') assert req.host == 'localhost' assert req.port == 80 def test_client_none_in_scope(): # Regression test for #2583 ...
35
762
falcon
tests/asgi/test_request_body_asgi.py
.py
import os import pytest import falcon import falcon.asgi import falcon.request import falcon.testing as testing SIZE_1_KB = 1024 @pytest.fixture def resource(): return testing.SimpleTestResourceAsync() @pytest.fixture def client(): app = falcon.asgi.App() return testing.TestClient(app) class TestRe...
111
3,597
falcon
tests/asgi/test_scope.py
.py
import asyncio import pytest import falcon from falcon import testing from falcon.asgi import App from falcon.errors import UnsupportedError from falcon.errors import UnsupportedScopeError class CustomCookies: def items(self): return [('foo', 'bar')] def test_missing_asgi_version(): scope = testin...
276
7,126
falcon
tests/asgi/test_lifespan_handlers.py
.py
import pytest import falcon from falcon import testing from falcon.asgi import App def test_at_least_one_event_method_required(): class Foo: pass app = App() with pytest.raises(TypeError): app.add_middleware(Foo()) def test_startup_only(): class Foo: async def process_star...
237
5,635
falcon
e2e-tests/test_e2e.py
.py
# Copyright 2020-2026 by Vytautas Liuolia. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
79
2,816
falcon
e2e-tests/conftest.py
.py
# Copyright 2020-2026 by Vytautas Liuolia. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
78
2,106
falcon
e2e-tests/server/hub.py
.py
from __future__ import annotations import asyncio import logging import typing import uuid from falcon.asgi import Request from falcon.asgi import Response from falcon.asgi import SSEvent from falcon.asgi import WebSocket logger = logging.getLogger(__name__) class Emitter: POLL_TIMEOUT = 3.0 def __init__(...
99
3,123
falcon
e2e-tests/server/app.py
.py
import pathlib import falcon import falcon.asgi from falcon.asgi.request import Request from falcon.asgi.response import Response from .chat import Chat from .hub import Events from .hub import Hub from .ping import Pong HERE = pathlib.Path(__file__).resolve().parent STATIC = HERE.parent / 'static' def create_app(...
32
781
falcon
e2e-tests/server/__init__.py
.py
from .app import create_app __all__ = ['app'] app = create_app()
6
67
falcon
e2e-tests/server/chat.py
.py
import re from falcon.asgi import Request from falcon.asgi import WebSocket from .hub import Hub class Chat: ALL = re.compile(r'^/all\s+(.+)$') MSG = re.compile(r'^/msg\s+(\w+)\s+(.+)$') def __init__(self, hub: Hub): self._hub = hub async def on_websocket(self, req: Request, ws: WebSocket,...
50
1,437
falcon
e2e-tests/server/ping.py
.py
from http import HTTPStatus import falcon from falcon.asgi import Request from falcon.asgi import Response class Pong: async def on_get(self, req: Request, resp: Response) -> None: resp.content_type = falcon.MEDIA_TEXT resp.text = 'PONG\n' # TODO(vytas): Properly type Response.status. ...
14
353
falcon
examples/things_advanced.py
.py
# examples/things_advanced.py import json import logging import uuid from wsgiref import simple_server import requests import falcon class StorageEngine: def get_things(self, marker, limit): return [{'id': str(uuid.uuid4()), 'color': 'green'}] def add_thing(self, thing): thing['id'] = str(...
230
7,246
falcon
examples/things.py
.py
# examples/things.py # Let's get this party started! from wsgiref.simple_server import make_server import falcon # Falcon follows the REST architectural style, meaning (among # other things) that you think in terms of resources and state # transitions, which map to HTTP verbs. class ThingsResource: def on_get(s...
41
1,251
falcon
examples/things_asgi.py
.py
# examples/things_asgi.py import falcon import falcon.asgi from falcon.asgi import Request from falcon.asgi import Response # Falcon follows the REST architectural style, meaning (among # other things) that you think in terms of resources and state # transitions, which map to HTTP verbs. class ThingsResource: as...
34
1,080
falcon
examples/quote.py
.py
import falcon class QuoteResource: def on_get(self, req: falcon.Request, resp: falcon.Response) -> None: """Handle GET requests.""" resp.media = { 'quote': "I've always been more interested in the future than in the past.", 'author': 'Grace Hopper', } app = falcon...
15
368
falcon
examples/things_advanced_asgi.py
.py
# examples/things_advanced_asgi.py import json import logging import uuid import httpx import falcon import falcon.asgi class StorageEngine: async def get_things(self, marker, limit): return [{'id': str(uuid.uuid4()), 'color': 'green'}] async def add_thing(self, thing): thing['id'] = str(u...
224
7,053
falcon
examples/look/look/app.py
.py
import os import falcon from .images import Collection from .images import ImageStore from .images import Item def create_app(image_store): app = falcon.App() app.add_route('/images', Collection(image_store)) app.add_route('/images/{name}', Item(image_store)) return app def get_app(): storage_...
21
446
falcon
examples/look/look/images.py
.py
import io import json import mimetypes import os import re import uuid import falcon class Collection: def __init__(self, image_store): self._image_store = image_store def on_get(self, req, resp): max_size = req.get_param_as_int('maxsize', min_value=1, default=-1) images = self._imag...
88
2,650
falcon
examples/look/tests/test_integration.py
.py
import os import requests def test_posted_image_gets_saved(): file_save_prefix = '/tmp/' location_prefix = '/images/' fake_image_bytes = b'fake-image-bytes' response = requests.post( 'http://localhost:8000/images', data=fake_image_bytes, headers={'content-type': 'image/png'},...
27
686
falcon
examples/look/tests/test_app.py
.py
import io import os from unittest import TestCase from unittest.mock import call from unittest.mock import MagicMock from unittest.mock import mock_open import uuid from wsgiref.validate import InputWrapper import pytest import falcon from falcon import testing import look.app import look.images @pytest.fixture de...
139
4,041
falcon
examples/look/tests/conftest.py
.py
import os import subprocess import sys import time import requests LOOK_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) gunicorn = None def pytest_sessionstart(session): global gunicorn gunicorn = subprocess.Popen( ( sys.executable, '-m', '...
41
861
falcon
examples/recipes/plain_text_main.py
.py
import functools import falcon class TextHandler(falcon.media.BaseHandler): DEFAULT_CHARSET = 'utf-8' @classmethod @functools.lru_cache def _get_charset(cls, content_type): _, params = falcon.parse_header(content_type) return params.get('charset') or cls.DEFAULT_CHARSET def dese...
21
570
falcon
examples/recipes/output_csv_stream_wsgi.py
.py
import csv import falcon class Report: class PseudoTextStream: def __init__(self): self.clear() def clear(self): self.result = [] def write(self, data): self.result.append(data.encode()) def fibonacci_generator(self, n=1000): stream = sel...
35
866
falcon
examples/recipes/request_id_middleware.py
.py
from uuid import uuid4 # Import the above context.py from my_app.context import ctx class RequestIDMiddleware: def process_request(self, req, resp): request_id = str(uuid4()) ctx.request_id = request_id # It may also be helpful to include the ID in the response def process_response(self,...
15
414
falcon
examples/recipes/multipart_mixed_main.py
.py
import falcon import falcon.media class Forms: def on_post(self, req, resp): example = {} for part in req.media: if part.content_type.startswith('multipart/mixed'): for nested in part.media: example[nested.filename] = nested.text resp.media ...
24
595
falcon
examples/recipes/request_id_log.py
.py
import logging # Import the above context.py from my_app.context import ctx def create_widget_object(name: str): request_id = f'request_id={ctx.request_id}' logging.debug('%s going to create widget: %s', request_id, name) try: # create the widget pass except Exception: loggin...
18
433
falcon
examples/recipes/header_name_case_mw.py
.py
class CustomHeadersMiddleware: def __init__(self, app, title_case=True, custom_capitalization=None): self._app = app self._title_case = title_case self._capitalization = custom_capitalization or {} def __call__(self, environ, start_response): def start_response_wrapper(status, r...
22
861
falcon
examples/recipes/pretty_json_intro.py
.py
import functools import json from falcon import media json_handler = media.JSONHandler( dumps=functools.partial(json.dumps, indent=4, sort_keys=True), )
9
159
falcon
examples/recipes/header_name_case_app.py
.py
import falcon # Import or copy CustomHeadersMiddleware from the above snippet class CustomHeadersMiddleware: ... class FunkyResource: def on_get(self, req, resp): resp.set_header('X-Funky-Header', 'test') resp.media = {'message': 'Hello'} app = falcon.App() app.add_route('/test', FunkyResource...
21
431
falcon
examples/recipes/output_csv_stream_asgi.py
.py
import csv import falcon class Report: class PseudoTextStream: def __init__(self): self.clear() def clear(self): self.result = [] def write(self, data): self.result.append(data.encode()) async def fibonacci_generator(self, n=1000): stream...
36
909
falcon
examples/recipes/output_csv_text_wsgi.py
.py
import csv import io import falcon class Report: def on_get(self, req, resp): output = io.StringIO() writer = csv.writer(output, quoting=csv.QUOTE_NONNUMERIC) writer.writerow(('fruit', 'quantity')) writer.writerow(('apples', 13)) writer.writerow(('oranges', 37)) r...
18
438
falcon
examples/recipes/raw_url_path_wsgi.py
.py
import falcon import falcon.uri class RawPathComponent: def process_request(self, req, resp): raw_uri = req.env.get('RAW_URI') or req.env.get('REQUEST_URI') # NOTE: Reconstruct the percent-encoded path from the raw URI. if raw_uri: req.path, _, _ = raw_uri.partition('?') cla...
31
848
falcon
examples/recipes/msgspec_media_validation.py
.py
import msgspec from falcon import Request from falcon import Response class MsgspecMiddleware: def process_resource( self, req: Request, resp: Response, resource: object, params: dict ) -> None: if schema := getattr(resource, f'{req.method}_SCHEMA', None): param = schema.__name__....
14
397
falcon
examples/recipes/msgspec_msgpack_handler.py
.py
from typing import Optional from msgspec import msgpack from falcon import media from falcon.typing import ReadableIO class MsgspecMessagePackHandler(media.BaseHandler): def deserialize( self, stream: ReadableIO, content_type: Optional[str], content_length: Optional[int], ) -...
23
529
falcon
examples/recipes/multipart_mixed_intro.py
.py
import falcon import falcon.media parser = falcon.media.MultipartFormHandler() parser.parse_options.media_handlers['multipart/mixed'] = ( falcon.media.MultipartFormHandler() )
8
181
falcon
examples/recipes/request_id_context.py
.py
import contextvars class _Context: def __init__(self): self._request_id_var = contextvars.ContextVar('request_id', default=None) @property def request_id(self): return self._request_id_var.get() @request_id.setter def request_id(self, value): self._request_id_var.set(valu...
18
342
falcon
examples/recipes/output_csv_text_asgi.py
.py
import csv import io import falcon class Report: async def on_get(self, req, resp): output = io.StringIO() writer = csv.writer(output, quoting=csv.QUOTE_NONNUMERIC) writer.writerow(('fruit', 'quantity')) writer.writerow(('apples', 13)) writer.writerow(('oranges', 37)) ...
18
444
falcon
examples/recipes/pretty_json_main.py
.py
import json import falcon class CustomJSONHandler(falcon.media.BaseHandler): MAX_INDENT_LEVEL = 8 def deserialize(self, stream, content_type, content_length): data = stream.read() return json.loads(data.decode()) def serialize(self, media, content_type): _, params = falcon.parse...
28
847
falcon
examples/recipes/raw_url_path_asgi.py
.py
import falcon.asgi import falcon.uri class RawPathComponent: async def process_request(self, req, resp): raw_path = req.scope.get('raw_path') # NOTE: Decode the raw path from the raw_path bytestring, disallowing # non-ASCII characters, assuming they are correctly percent-coded. ...
32
931
falcon
examples/recipes/request_id_structlog.py
.py
from uuid import uuid4 # Optional logging package (pip install structlog) import structlog class RequestIDMiddleware: def process_request(self, req, resp): request_id = str(uuid4()) # Using Falcon 2.0+ context style req.context.request_id = request_id # Or if your logger has bui...
20
613
falcon
examples/recipes/msgspec_json_handler.py
.py
import msgspec import falcon.media json_handler = falcon.media.JSONHandler( dumps=msgspec.json.encode, loads=msgspec.json.decode, )
9
142
falcon
examples/recipes/msgspec_main.py
.py
from datetime import datetime from datetime import timezone from functools import partial from http import HTTPStatus from typing import Annotated, Any import uuid import msgspec import falcon from falcon import Request from falcon import Response from falcon.media import JSONHandler def _utc_now() -> datetime: ...
90
2,717
falcon
examples/ws_tutorial/tests/test_asgi_http.py
.py
from pathlib import Path def test_hello_http_call(client): response = client.simulate_get('/hello') assert response.status_code == 200 data = response.json assert data == {'hello': 'world'} def test_fallback(client): response = client.simulate_get('/missing') assert response.status_code == 2...
17
503
falcon
examples/ws_tutorial/tests/test_asgi_ws.py
.py
from copy import copy import pytest from ws_tutorial.app import app from ws_tutorial.app import AuthMiddleware from falcon import errors from falcon import testing @pytest.mark.asyncio async def test_websocket_echo(): async with testing.ASGIConductor(app) as conn: async with conn.simulate_ws('/echo') as...
63
1,971
falcon
examples/ws_tutorial/tests/conftest.py
.py
import pytest from ws_tutorial.app import app import falcon.testing @pytest.fixture() def client(): return falcon.testing.TestClient(app)
10
145
falcon
examples/ws_tutorial/ws_tutorial/app.py
.py
from datetime import datetime import logging import pathlib import uvicorn from falcon import WebSocketDisconnected import falcon.asgi from falcon.asgi import Request from falcon.asgi import WebSocket logger = logging.getLogger('ws-logger') logger.setLevel('INFO') logger.addHandler(logging.StreamHandler()) REPORTS...
125
3,665
falcon
examples/ws_tutorial/ws_tutorial/reports_client.py
.py
# This is a simple example of a WebSocket client that sends a message to the server. # Since it's an example using the `websockets` library and it isn't using anything # specific to Falcon, there are no tests. Coverage is skipped for this module. import asyncio import websockets async def send_message(): uri = ...
28
817
falcon
examples/ws_tutorial/ws_tutorial/client.py
.py
# This is a simple example of a WebSocket client that sends a message to the server. # Since it's an example using the `websockets` library, and it isn't using anything # specific to Falcon, there are no tests. Coverage is skipped for this module. import asyncio import websockets async def send_message(): uri =...
25
724
falcon
examples/asgilook/tests/test_thumbnails.py
.py
def test_missing_in_store(client): resp = client.simulate_get( '/thumbnails/1a256a8a-2063-46ff-b53f-d04d5bcf5eee/80x80.jpeg' ) assert resp.status_code == 404 def test_thumbnails(client, png_image, image_size): resp1 = client.simulate_post('/images', body=png_image) assert resp1.status_code...
49
1,609
falcon
examples/asgilook/tests/test_images.py
.py
def test_list_images(client): resp1 = client.simulate_get('/images') assert resp1.status_code == 200 assert resp1.headers.get('X-ASGILook-Cache') == 'Miss' assert resp1.json == [] resp2 = client.simulate_get('/images') assert resp2.status_code == 200 assert resp2.headers.get('X-ASGILook-Cac...
41
1,479
falcon
examples/asgilook/tests/conftest.py
.py
import io import random import uuid import fakeredis.aioredis import PIL.Image import PIL.ImageDraw import pytest import falcon.asgi import falcon.testing from asgilook.app import create_app from asgilook.config import Config @pytest.fixture() def predictable_uuid(): fixtures = ( uuid.UUID('36562622-48...
87
2,231
falcon
examples/asgilook/asgilook/app.py
.py
import falcon.asgi from .cache import RedisCache from .config import Config from .images import Images from .images import Thumbnails from .store import Store def create_app(config=None): config = config or Config() cache = RedisCache(config) store = Store(config) images = Images(config, store) t...
25
629
falcon
examples/asgilook/asgilook/store.py
.py
import asyncio import datetime import io import aiofiles import PIL.Image import falcon class Image: def __init__(self, config, image_id, size): self._config = config self.image_id = image_id self.size = size self.modified = datetime.datetime.now(datetime.timezone.utc) @pro...
98
2,753
falcon
examples/asgilook/asgilook/asgi.py
.py
from .app import create_app app = create_app()
4
48
falcon
examples/asgilook/asgilook/images.py
.py
import aiofiles import falcon class Images: def __init__(self, config, store): self._config = config self._store = store async def on_get(self, req, resp): resp.media = [image.serialize() for image in self._store.list_images()] async def on_get_image(self, req, resp, image_id): ...
46
1,368
falcon
examples/asgilook/asgilook/config.py
.py
import os import pathlib import uuid import redis.asyncio class Config: DEFAULT_CONFIG_PATH = '/tmp/asgilook' DEFAULT_MIN_THUMB_SIZE = 64 DEFAULT_REDIS_FROM_URL = redis.asyncio.from_url DEFAULT_REDIS_HOST = 'redis://localhost' DEFAULT_UUID_GENERATOR = uuid.uuid4 def __init__(self): s...
25
732
falcon
examples/asgilook/asgilook/cache.py
.py
import msgpack class RedisCache: PREFIX = 'asgilook:' INVALIDATE_ON = frozenset({'DELETE', 'POST', 'PUT'}) CACHE_HEADER = 'X-ASGILook-Cache' TTL = 3600 def __init__(self, config): self._config = config self._redis = self._config.redis_from_url(self._config.redis_host) async d...
54
1,675
falcon
falcon/middleware.py
.py
from __future__ import annotations from collections.abc import Iterable from typing import Literal, TYPE_CHECKING from ._typing import _AReqT from ._typing import _ARespT from ._typing import UniversalMiddlewareWithProcessResponse if TYPE_CHECKING: from .asgi.request import Request as AsgiRequest from .asgi....
178
7,454
falcon
falcon/request_helpers.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
178
6,245
falcon
falcon/errors.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
2,749
107,818
falcon
falcon/app.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
1,369
57,360
falcon
falcon/http_status.py
.py
# Copyright 2015 by Hurricane Labs LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
72
2,476
falcon
falcon/asgi_spec.py
.py
# Copyright 2020 by Kurt Griffiths # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
71
2,056
falcon
falcon/status_codes.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
393
12,619
falcon
falcon/http_error.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
265
9,318
falcon
falcon/request.py
.py
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
2,888
106,550
falcon
falcon/redirects.py
.py
# Copyright 2015 by Kurt Griffiths # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
180
6,239
falcon
falcon/__init__.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
663
21,894
falcon
falcon/hooks.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
397
14,384
falcon
falcon/inspect.py
.py
# Copyright 2020-2026 by Federico Caselli # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
834
28,513
falcon
falcon/_typing.py
.py
# Copyright 2021-2026 by Vytautas Liuolia. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
390
11,389
falcon
falcon/constants.py
.py
from enum import auto from enum import Enum import os import sys __all__ = ( 'HTTP_METHODS', 'HTTP_WG_DRAFT_METHODS', 'WEBDAV_METHODS', 'COMBINED_METHODS', 'DEFAULT_MEDIA_TYPE', 'MEDIA_BMP', 'MEDIA_GIF', 'MEDIA_HTML', 'MEDIA_JPEG', 'MEDIA_JS', 'MEDIA_JSON', 'MEDIA_MSGPAC...
218
6,162
falcon
falcon/app_helpers.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
405
15,546
falcon
falcon/response_helpers.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
149
4,747
falcon
falcon/forwarded.py
.py
# Based on code from the aiohttp project, Copyright 2013-2017 by Nikolay Kim and # Andrew Svetlov, with modifications for the Falcon project by Kurt Griffiths. # # See also: # # https://github.com/aio-libs/aiohttp/blob/master/aiohttp/web_request.py # # Licensed under the Apache License, Version 2.0 (the "License"); #...
192
6,545
falcon
falcon/typing.py
.py
# Copyright 2024 by Federico Caselli # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
68
1,799
falcon
falcon/response.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
1,478
57,265
falcon
falcon/uri.py
.py
"""URI utilities. This module provides utility functions to parse, encode, decode, and otherwise manipulate a URI. These functions are not available directly in the `falcon` module, and so must be explicitly imported:: from falcon import uri name, port = uri.parse_host('example.org:8080') """ # NOTE(kgriffs...
35
1,015
falcon
falcon/stream.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
183
5,690
falcon
falcon/responders.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
115
3,887
falcon
falcon/testing/__init__.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
197
6,780
falcon
falcon/testing/client.py
.py
# Copyright 2016 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
2,422
102,930
falcon
falcon/testing/resource.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
278
9,759
falcon
falcon/testing/srmock.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
69
2,264
falcon
falcon/testing/helpers.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
1,560
58,388
falcon
falcon/testing/test_case.py
.py
# Copyright 2016 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
96
3,273
falcon
falcon/cmd/inspect_app.py
.py
#!/usr/bin/env python # Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the 'License'); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
111
3,261
falcon
falcon/cmd/bench.py
.py
# Copyright 2013 by Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
36
940
falcon
falcon/media/json.py
.py
from __future__ import annotations from functools import partial import json from typing import Any, Callable from falcon import errors from falcon import http_error from falcon.media.base import BaseHandler from falcon.media.base import TextBaseHandlerWS from falcon.typing import AsyncReadableIO from falcon.typing i...
308
11,406