A collection of tools available for FastApifast-tools is a FastApi/Starlette toolset, Most of the tools can be used in FastApi/Starlette, a few tools only support FastApi which is divided into the lack of compatibility with FastApi

so1n, updated 🕥 2023-02-14 22:21:05

fast-tools

fast-tools is a FastApi/Starlette toolset, Most of the tools can be used in FastApi/Starlette, a few tools only support FastApi which is divided into the lack of compatibility with FastApi

Note: this is alpha quality code still, the API may change, and things may fall apart while you try it.

```python

origin of name

project_name = ('FastApi'[:2] + 'Starlette'[:2]).lower() + '-tools' print(project_name) # 'fast-tools' ``` 中文文档

Usage

0.base

  • explanation: Some tool dependencies of fast-tools and can also be used alone
  • applicable framework:FastApi,Starlette, more....

0.1.redis_helper

  • explanation: It is used to encapsulate the conn pool of aioredis and encapsulate some common commands. ```python import aioredis from fastapi import FastAPI

from fast_tools.base import RedisHelper

app: 'FastApi' = FastAPI() redis_helper: 'RedisHelper' = RedisHelper() # init object

@app.on_event("startup") async def startup(): # create redis conn pool and connect redis_helper.init(await aioredis.create_pool('redis://localhost', minsize=1, maxsize=10, encoding='utf-8'))

app.on_event("shutdown") async def shutdown(): # close redis conn pool await redis_helper.close()

@app.get("/") async def root() -> dict: info = await redis_helper.client.info() return {"info": info}

if name == 'main': import uvicorn uvicorn.run(app) ```

0.2.route_trie

Most of python's web framework routing lookups traverse the entire routing table. If the current url matches the registered url of the route, the lookup is successful. It can be found that the time complexity of the route lookup is O(n). I guess the reason why the python web framework uses the traversal routing table is to support /api/user/{user_id} while keeping it simple. It can be found that the time complexity of each route lookup is O(n). When the number of routes reaches a certain level, the matching time will becomes slower, but when we use middleware, if we need to check whether the route is matched, then It needs to be matched again, and this piece of ours can be controlled, so we need to optimize the routing matching speed here.

The fastest route matching speed is dict, but it cannot support urls similar to /api/user/{user_id}. Fortunately, the url matches the data structure of the trie, so the trie is used to refactor the route search, which can be as fast as possible Match the approximate area of the route, and then perform regular matching to check whether the route is correct. ```Python from typing import ( List, Optional ) from fastapi import FastAPI from starlette.routing import Route from fast_tools.base import RouteTrie

app: 'FastAPI' = FastAPI()

@app.get("/") async def root() -> dict: return {"Hello": "World"}

@app.get("/api/users/login") async def user_login() -> str: return 'ok'

route_trie: RouteTrie = RouteTrie() # init route trie route_trie.insert_by_app(app) # load route from app

def print_route(route_list: Optional[List[Route]]): """print route list """ if route_list: for route in route_list: print(f'route:{route} url:{route.path}') else: print(f'route:{route_list} url: not found')

Scope param is needed to match app routing, you can learn more from the exporter example

print_route(route_trie.search('/')) print_route(route_trie.search('/api/users/login')) ``` Simply compare the efficiency of the built-in route matching and trie matching

1.exporter

  • explanation: A prometheus exporter middleware that can be used for Starlette and FastAPI, which can monitor the status of each URL, such as the number of connections, the number of responses, the number of requests, the number of errors, and the number of current requests.
  • applicable framework: FastApi,Starlette

1.1 install

pip install prometheus_client

1.2 Usage

```python from typing import Optional

from fastapi import FastAPI from fast_tools.exporter import PrometheusMiddleware, get_metrics from fast_tools.base.route_trie import RouteTrie

app = FastAPI() route_trie = RouteTrie()

app.add_middleware( PrometheusMiddleware, route_trie=route_trie, # use route trie, speed up routing query block_url_set={"/metrics"} # not monitor url: /metrics )

app.add_route("/metrics", get_metrics) ```

1.3 example

example

2.cbv

  • explanation: At present, due to the changes of fastapi, fastapi does not yet support cbv mode, only fastapi_utils Provides cbv support, but I feel that it is not very convenient to use, so I reused its core code and made some modifications.You can use cbv like Starlette, and provide cbv_decorator to support other functions of fastapi.
  • applicable framework: FastApi

```python

!/usr/bin/env python3

-- coding: utf-8 --

author = 'so1n' date = '2020-08' from fastapi import FastAPI, Depends, Header, Query from fast_tools.cbv import cbv_decorator, Cbv

app = FastAPI()

def get_user_agent(user_agent: str = Header("User-Agent")) -> str: return user_agent

class TestCbv(object): # Don't worry about the parent attribute. # Every time the get or post method is called, a new object is actually created and passed in through self. # Different requests will not share the same object. host: str = Header('host') user_agent: str = Depends(get_user_agent)

def __init__(self, test_default_id: int = Query(123)):
    """support __init__ method param"""
    self.test_default_id = test_default_id

def _response(self):
    return {"message": "hello, world", "user_agent": self.user_agent, "host": self.host, "id": self.test_default_id}

@cbv_decorator(status_code=203)   # only support fastapi.route.add_api_route keywords param
def get(self):
    return self._response()

def post(self):
    return self._response()

app.include_router(Cbv(TestCbv).router)

if name == 'main': import uvicorn uvicorn.run(app) ```

3.config

  • explanation: config is an object that provides configuration files to be converted into python objects. config is based on Pydantic and Type Hints, so it can quickly convert or verify parameters without using a large amount of code.
  • applicable framework: FastApi,Starlette ```python from typing import List, Optional

from pydantic.fields import Json

from fast_tools.config import Config

class MyConfig(Config): DEBUG: bool HOST: str PORT: int

REDIS_ADDRESS: str
REDIS_PASS: Optional[str] = None  # Set the default value, if the configuration file does not have this value and does not set the default value, an error will be reported

MYSQL_DB_HOST: str
MYSQL_DB_NAME: str
MYSQL_DB_PASS: str
MYSQL_DB_USER: str
ES_HOST: Json[List]
TEST_LIST_INT: Json[List]
YML_ES_HOST: Optional[List[str]] = None
YML_TEST_LIST_INT: Optional[List[int]] = None

``` config supports the following parameters: - config_file: config file,Support ini and yml config files, f the value is empty, data is pulled from environment variables (but only a global dictionary is pulled), see example - group: group can specify a configuration group. When using ini and yml files, multiple group configurations are supported, such as dev configuration and test configuration. If you don't want to configure this option in the code, you can directly configure group=test in the environment variable. - global_key: Specify that group as the global configuration. When using ini and yml files, multiple group configurations are supported, and there is also a global configuration, which can be shared by multiple groups (if the group does not have a corresponding configuration, it will be referenced to the global_key Configuration, if there is no reference)

see example

4.context

  • explanation:Using the characteristics of contextvars, you can conveniently call what you need in the route, without the need to call like requests.app.state, and it can also support type hints to facilitate writing code.
  • applicable framework: FastApi,Starlette

```python import asyncio import httpx import uuid from contextvars import ( copy_context, Context ) from functools import partial from fastapi import ( FastAPI, Request, Response ) from fast_tools.context import ( ContextBaseModel, ContextMiddleware, CustomHelper, HeaderHelper, )

app = FastAPI() client = httpx.AsyncClient()

class ContextModel(ContextBaseModel): # ContextBaseModel save data to contextvars request_id: str = HeaderHelper( 'X-Request-Id', default_func=lambda request: str(uuid.uuid4()) ) ip: str = HeaderHelper( 'X-Real-IP', default_func=lambda request: request.client.host ) user_agent: str = HeaderHelper('User-Agent')

# CustomHelper is a encapsulation of Context calls, and data can be read in the current context (if you want to set data, you need to instantiate it first)
http_client: httpx.AsyncClient = CustomHelper('http_client')

async def before_request(self, request: Request):
    """The method that will be called before the request is executed"""
    self.http_client = httpx.AsyncClient()

async def after_response(self, request: Request, response: Response):
    """The method that will be called after the request is executed"""
    pass

async def before_reset_context(self, request: Request, response: Response):
    """The method that will be called before the context is destroyed"""
    await self.http_client.aclose()

ContextMiddleware is used to store data to ContextBaseModel before requesting, and to reset contextvars data before responding to data

app.add_middleware(ContextMiddleware, context_model=ContextModel())

async def test_ensure_future(): print(f'test_ensure_future {ContextModel.http_client}')

def test_run_in_executor(): print(f'test_run_in_executor {ContextModel.http_client}')

def test_call_soon(): print(f'test_call_soon {ContextModel.http_client}')

@app.get("/") async def root(): # Python will automatically copy the context asyncio.ensure_future(test_ensure_future()) loop: 'asyncio.get_event_loop()' = asyncio.get_event_loop()

# Python will automatically copy the context
loop.call_soon(test_call_soon)

# When opening another thread for processing, you need to copy the context yourself
ctx: Context = copy_context()
await loop.run_in_executor(None, partial(ctx.run, test_run_in_executor))

return {
    "message": ContextModel.to_dict(is_safe_return=True),  # Only return data that can be converted to json
    "local_ip": (await ContextModel.http_client.get('http://icanhazip.com')).text
}

if name == 'main': import uvicorn uvicorn.run(app) ```

5.statsd_middleware

  • explanation: The method of use is similar to exporter, but there is an additional url_replace_handle to handle url
  • applicable framework: FastApi,Starlette

5.1install

pip install aiostatsd ```python from typing import Optional

from fastapi import FastAPI from fast_tools.statsd_middleware import StatsdClient, StatsdMiddleware from fast_tools.base.route_trie import RouteTrie

app = FastAPI() client = StatsdClient() route_trie = RouteTrie()

app.add_middleware( StatsdMiddleware, client=client, route_trie=route_trie, url_replace_handle=lambda url: url.replace('/', '_'), # Metric naming does not support'/' symbol block_url_set={"/"} ) app.on_event("shutdown")(client.close)

@app.on_event("startup") async def startup_event(): await client.connect() route_trie.insert_by_app(app)

@app.get("/") async def root(): return {"Hello": "World"}

@app.get("/api/users/{user_id}/items/{item_id}") async def read_user_item( user_id: int, item_id: str, q: Optional[str] = None, short: bool = False ): """ copy from:https://fastapi.tiangolo.com/tutorial/query-params/#multiple-path-and-query-parameters """ item = {"item_id": item_id, "owner_id": user_id} if q: item.update({"q": q}) if not short: item.update( {"description": "This is an amazing item that has a long description"} ) return item

@app.get("/api/users/login") async def user_login(): return 'ok'

if name == 'main': import uvicorn uvicorn.run(app) ```

6.task

  • explanation:The ideal architecture does not need to use task, so task is not recommended, but it may be used in the evolution of the architecture
  • applicable framework: FastApi,Starlette ```python import time from fastapi import FastAPI from fast_tools.task import background_task from fast_tools.task import stop_task

app = FastAPI()

call before start

@app.on_event("startup")

Execute every 10 seconds

@background_task(seconds=10) def test_task() -> None: print(f'test.....{int(time.time())}')

stop

app.on_event("shutdown")(stop_task)

if name == 'main': import uvicorn uvicorn.run(app) ```

7.cache

  • explanation: Use the return type hint of the function to adaptively cache the corresponding response, and return the cached data when the next request and the cache time has not expired.
  • applicable framework: FastApi,Starlette
  • PS: The reason for the return type prompt judgment logic is to reduce the number of judgments. When there is an IDE to write code, the return response will be the same as the return type prompt ```python import time

import aioredis from fastapi import FastAPI from starlette.responses import JSONResponse

from fast_tools.base import RedisHelper from fast_tools.cache import ( cache, cache_control )

app = FastAPI() redis_helper: 'RedisHelper' = RedisHelper()

@app.on_event("startup") async def startup(): redis_helper.init(await aioredis.create_pool('redis://localhost', minsize=1, maxsize=10, encoding='utf-8'))

@app.on_event("shutdown") async def shutdown(): if not redis_helper.closed: await redis_helper.close()

@app.get("/") @cache(redis_helper, 60) async def root() -> dict: """Read the dict data and send the corresponding response data according to the response (the default is JSONResponse)""" return {"timestamp": time.time()}

adter_cache_response_listSupport the incoming function and execute it before returning the cached response. For details, see the usage method of the example

cache_control Will add the cache time to the http header when returning the cached response

@app.get("/api/users/login") @cache(redis_helper, 60, after_cache_response_list=[cache_control]) async def user_login() -> JSONResponse: """The response type cache does not cache the entire instance, but caches the main data in the instance, and re-splices it into a new respnose the next time it returns to the cache.""" return JSONResponse({"timestamp": time.time()})

@app.get("api/null") @cache(redis_helper, 60) async def test_not_return_annotation(): """Functions without return annotation will not be cached""" return JSONResponse({"timestamp": time.time()})

if name == 'main': import uvicorn uvicorn.run(app) ```

8.limit

  • explanation: Use common current-limiting algorithms to limit the flow of requests, and support different user groups with different flow-limiting rules. Support decorators as a single function or use middleware to limit the flow of requests that meet the URL rules. Backend supports memory-based Token bucket and redis-based token bucket, cell module, and window limit
  • applicable framework: FastApi,Starlette ```python from typing import Optional, Tuple

import aioredis from fastapi import FastAPI, Request from fast_tools.base import RedisHelper from fast_tools import limit

def limit_func(requests: Request) -> Tuple[str, str]: """limit needs to determine the current request key and group according to the function""" return requests.session['user'], requests.session['group']

app = FastAPI() redis_helper: 'RedisHelper' = RedisHelper()

@app.on_event("startup") async def startup(): redis_helper.init(await aioredis.create_pool('redis://localhost', minsize=1, maxsize=10, encoding='utf-8'))

For requests starting with /api, the admin group can request 10 times per second, while the user group can only request once per second

app.add_middleware( limit.LimitMiddleware, func=limit_func, rule_dict={ r"^/api": [limit.Rule(second=1, gen_token_num=10, group='admin'), limit.Rule(second=1, group='user')] } )

Each ip can only be requested once every 10 seconds

@app.get("/") @limit.limit( [limit.Rule(second=10, gen_token_num=1)], limit.backend.RedisFixedWindowBackend(redis_helper), limit_func=limit.func.client_ip ) async def root(): return {"Hello": "World"}

@app.get("/api/users/{user_id}/items/{item_id}") async def read_user_item( user_id: int, item_id: str, q: Optional[str] = None, short: bool = False ): """ copy from:https://fastapi.tiangolo.com/tutorial/query-params/#multiple-path-and-query-parameters """ item = {"item_id": item_id, "owner_id": user_id} if q: item.update({"q": q}) if not short: item.update( {"description": "This is an amazing item that has a long description"} ) return item

@app.get("/api/users/login") async def user_login(): return 'ok'

if name == 'main': import uvicorn uvicorn.run(app) ```

9.share

  • explanation: share is used to share the same time-consuming result in multiple coroutines in the same thread, see example
  • applicable framework: FastApi,Starlette

Issues

Bump starlette from 0.14.2 to 0.25.0

opened on 2023-02-14 22:21:04 by dependabot[bot]

Bumps starlette from 0.14.2 to 0.25.0.

Release notes

Sourced from starlette's releases.

Version 0.25.0

Fixed

  • Limit the number of fields and files when parsing multipart/form-data on the MultipartParser 8c74c2c and #2036.

Version 0.24.0

Added

  • Allow StaticFiles to follow symlinks #1683.
  • Allow Request.form() as a context manager #1903.
  • Add size attribute to UploadFile #1405.
  • Add env_prefix argument to Config #1990.
  • Add template context processors #1904.
  • Support str and datetime on expires parameter on the Response.set_cookie method #1908.

Changed

  • Lazily build the middleware stack #2017.
  • Make the file argument required on UploadFile #1413.
  • Use debug extension instead of custom response template extension #1991.

Fixed

  • Fix url parsing of ipv6 urls on URL.replace #1965.

Version 0.23.1

Fixed

  • Only stop receiving stream on body_stream if body is empty on the BaseHTTPMiddleware #1940.

Version 0.23.0

Added

  • Add headers parameter to the TestClient #1966.

Deprecated

  • Deprecate Starlette and Router decorators #1897.

Fixed

  • Fix bug on FloatConvertor regex #1973.

Version 0.22.0

Changed

  • Bypass GZipMiddleware when response includes Content-Encoding #1901.

Fixed

  • Remove unneeded unquote() from query parameters on the TestClient #1953.
  • Make sure MutableHeaders._list is actually a list #1917.
  • Import compatibility with the next version of AnyIO #1936.

Version 0.21.0

This release replaces the underlying HTTP client used on the TestClient (requests :arrow_right: httpx), and as those clients differ a bit on their API, your test suite will likely break. To make the migration smoother, you can use the bump-testclient tool.

Changed

  • Replace requests with httpx in TestClient #1376.

... (truncated)

Changelog

Sourced from starlette's changelog.

0.25.0

February 14, 2023

Fix

  • Limit the number of fields and files when parsing multipart/form-data on the MultipartParser 8c74c2c and #2036.

0.24.0

February 6, 2023

Added

  • Allow StaticFiles to follow symlinks #1683.
  • Allow Request.form() as a context manager #1903.
  • Add size attribute to UploadFile #1405.
  • Add env_prefix argument to Config #1990.
  • Add template context processors #1904.
  • Support str and datetime on expires parameter on the Response.set_cookie method #1908.

Changed

  • Lazily build the middleware stack #2017.
  • Make the file argument required on UploadFile #1413.
  • Use debug extension instead of custom response template extension #1991.

Fixed

  • Fix url parsing of ipv6 urls on URL.replace #1965.

0.23.1

December 9, 2022

Fixed

  • Only stop receiving stream on body_stream if body is empty on the BaseHTTPMiddleware #1940.

0.23.0

December 5, 2022

Added

  • Add headers parameter to the TestClient #1966.

Deprecated

  • Deprecate Starlette and Router decorators #1897.

Fixed

  • Fix bug on FloatConvertor regex #1973.

0.22.0

November 17, 2022

... (truncated)

Commits
  • fc48089 Version 0.25.0 (#2035)
  • bb4d8f9 🐛 Close all the multipart files on error (#2036)
  • 8c74c2c Merge pull request from GHSA-74m5-2c7w-9w3x
  • 5771a78 Fix test not passing in 32-bit architectures (#2033)
  • 337ae24 Document that UploadFile's filename and content_type can be None (#2029)
  • 218a6b4 Version 0.24.0 (#1983)
  • e05b632 Feature: Add size attribute to UploadFile (#1405)
  • c568b55 allow using Request.form() as a context manager (#1903)
  • 0a63a6e Support str and datetime on expires parameter on the set_cookie metho...
  • 94a22b8 Fix url parsing of ipv6 urls on URL.replace (#1965)
  • Additional commits viewable in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/so1n/fast-tools/network/alerts).

Bump certifi from 2021.10.8 to 2022.12.7

opened on 2022-12-08 12:47:47 by dependabot[bot]

Bumps certifi from 2021.10.8 to 2022.12.7.

Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/so1n/fast-tools/network/alerts).

Bump protobuf from 3.19.1 to 3.19.5

opened on 2022-09-23 21:12:28 by dependabot[bot]

Bumps protobuf from 3.19.1 to 3.19.5.

Release notes

Sourced from protobuf's releases.

Protocol Buffers v3.19.5

C++

Protocol Buffers v3.19.4

Python

  • Make libprotobuf symbols local on OSX to fix issue #9395 (#9435)

Ruby

  • Fixed a data loss bug that could occur when the number of optional fields in a message is an exact multiple of 32. (#9440).

PHP

  • Fixed a data loss bug that could occur when the number of optional fields in a message is an exact multiple of 32. (#9440).

Protocol Buffers v3.19.3

Python

  • Fix missing Windows wheel for Python 3.10 on PyPI

Protocol Buffers v3.19.2

Java

Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/so1n/fast-tools/network/alerts).

Bump ujson from 4.3.0 to 5.4.0

opened on 2022-07-05 22:23:13 by dependabot[bot]

Bumps ujson from 4.3.0 to 5.4.0.

Release notes

Sourced from ujson's releases.

5.4.0

Added

Fixed

5.3.0

Added

Changed

Fixed

5.2.0

Added

Fixed

5.1.0

Changed

... (truncated)

Commits
  • 9c20de0 Merge pull request from GHSA-fm67-cv37-96ff
  • b21da40 Fix double free on string decoding if realloc fails
  • 67ec071 Merge pull request #555 from JustAnotherArchivist/fix-decode-surrogates-2
  • bc7bdff Replace wchar_t string decoding implementation with a uint32_t-based one
  • cc70119 Merge pull request #548 from JustAnotherArchivist/arbitrary-ints
  • 4b5cccc Merge pull request #553 from bwoodsend/pypy-ci
  • abe26fc Merge pull request #551 from bwoodsend/bye-bye-travis
  • 3efb5cc Delete old TravisCI workflow and references.
  • 404de1a xfail test_decode_surrogate_characters() on Windows PyPy.
  • f7e66dc Switch to musl docker base images.
  • Additional commits viewable in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/so1n/fast-tools/network/alerts).

Bump httpx from 0.21.1 to 0.23.0

opened on 2022-06-01 23:59:11 by dependabot[bot]

Bumps httpx from 0.21.1 to 0.23.0.

Release notes

Sourced from httpx's releases.

Version 0.23.0

0.23.0 (23rd May, 2022)

Changed

  • Drop support for Python 3.6. (#2097)
  • Use utf-8 as the default character set, instead of falling back to charset-normalizer for auto-detection. To enable automatic character set detection, see the documentation. (#2165)

Fixed

  • Fix URL.copy_with for some oddly formed URL cases. (#2185)
  • Digest authentication should use case-insensitive comparison for determining which algorithm is being used. (#2204)
  • Fix console markup escaping in command line client. (#1866)
  • When files are used in multipart upload, ensure we always seek to the start of the file. (#2065)
  • Ensure that iter_bytes never yields zero-length chunks. (#2068)
  • Preserve Authorization header for redirects that are to the same origin, but are an http-to-https upgrade. (#2074)
  • When responses have binary output, don't print the output to the console in the command line client. Use output like <16086 bytes of binary data> instead. (#2076)
  • Fix display of --proxies argument in the command line client help. (#2125)
  • Close responses when task cancellations occur during stream reading. (#2156)
  • Fix type error on accessing .request on HTTPError exceptions. (#2158)

Version 0.22.0

0.22.0 (26th January, 2022)

Added

Fixed

  • Don't perform unreliable close/warning on __del__ with unclosed clients. (#2026)
  • Fix Headers.update(...) to correctly handle repeated headers (#2038)

Version 0.21.3

0.21.3 (6th January, 2022)

Fixed

  • Fix streaming uploads using SyncByteStream or AsyncByteStream. Regression in 0.21.2. (#2016)

Version 0.21.2

0.21.2 (5th January, 2022)

Fixed

  • HTTP/2 support for tunnelled proxy cases. (#2009)
  • Improved the speed of large file uploads. (#1948)
Changelog

Sourced from httpx's changelog.

0.23.0 (23rd May, 2022)

Changed

  • Drop support for Python 3.6. (#2097)
  • Use utf-8 as the default character set, instead of falling back to charset-normalizer for auto-detection. To enable automatic character set detection, see the documentation. (#2165)

Fixed

  • Fix URL.copy_with for some oddly formed URL cases. (#2185)
  • Digest authentication should use case-insensitive comparison for determining which algorithm is being used. (#2204)
  • Fix console markup escaping in command line client. (#1866)
  • When files are used in multipart upload, ensure we always seek to the start of the file. (#2065)
  • Ensure that iter_bytes never yields zero-length chunks. (#2068)
  • Preserve Authorization header for redirects that are to the same origin, but are an http-to-https upgrade. (#2074)
  • When responses have binary output, don't print the output to the console in the command line client. Use output like <16086 bytes of binary data> instead. (#2076)
  • Fix display of --proxies argument in the command line client help. (#2125)
  • Close responses when task cancellations occur during stream reading. (#2156)
  • Fix type error on accessing .request on HTTPError exceptions. (#2158)

0.22.0 (26th January, 2022)

Added

Fixed

  • Don't perform unreliable close/warning on __del__ with unclosed clients. (#2026)
  • Fix Headers.update(...) to correctly handle repeated headers (#2038)

0.21.3 (6th January, 2022)

Fixed

  • Fix streaming uploads using SyncByteStream or AsyncByteStream. Regression in 0.21.2. (#2016)

0.21.2 (5th January, 2022)

Fixed

  • HTTP/2 support for tunnelled proxy cases. (#2009)
  • Improved the speed of large file uploads. (#1948)
Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/so1n/fast-tools/network/alerts).

fastapi starlette