- Saved searches
- Use saved searches to filter your results more quickly
- License
- aio-libs/aiohttp
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Welcome to AIOHTTP¶
- Key Features¶
- Library Installation¶
- Installing all speedups in one command¶
- Getting Started¶
- Client example¶
- Server example:¶
- What’s new in aiohttp 3?¶
- Tutorial¶
- Source code¶
- Dependencies¶
- Communication channels¶
- Contributing¶
- Authors and License¶
- Policy for Backward Incompatible Changes¶
- Table Of Contents¶
- aiohttp
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Asynchronous HTTP client/server framework for asyncio and Python
License
aio-libs/aiohttp
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
- Typehint for function
from_path
no longer enforcePathLike
as its first argument - Minor improvement over the global detection reliability
- Introduce function
is_binary
that relies on main capabilities, and is optimized to detect binaries - Propagate
enable_fallback
argument throughoutfrom_bytes
,from_path
, andfrom_fp
that allow a deeper control over the detection (default True) - Explicit support for Python 3.12
- Edge case detection failure where a file would contain ‘very-long’ camel-cased word (Issue #289) https://redirect.github.com/Ousret/charset_normalizer/issues/289″>#289)
- Argument
should_rename_legacy
for legacy functiondetect
and disregard any new arguments without errors (PR #262) https://redirect.github.com/Ousret/charset_normalizer/issues/262″>#262)
- Support for Python 3.6 (PR #260) https://redirect.github.com/Ousret/charset_normalizer/issues/260″>#260)
- Optional speedup provided by mypy/c 1.0.1
- Multi-bytes cutter/chunk generator did not always cut correctly (PR #233) https://redirect.github.com/Ousret/charset_normalizer/issues/233″>#233)
- Speedup provided using mypy/c 0.990 on Python >= 3.7
- Extend the capability of explain=True when cp_isolation contains at most two entries (min one), will log in details of the Mess-detector results
- Support for alternative language frequency set in charset_normalizer.assets.FREQUENCIES
- Add parameter
language_threshold
infrom_bytes
,from_path
andfrom_fp
to adjust the minimum expected coherence ratio normalizer --version
now specify if the current version provides extra speedup (meaning mypyc compilation whl)
- Build with static metadata (not pyproject.toml yet)
- Make language detection stricter
- Optional: Module
md.py
can be compiled using Mypyc to provide an extra speedup up to 4x faster than v2.1
- Typehint for function
from_path
no longer enforcePathLike
as its first argument - Minor improvement over the global detection reliability
- Introduce function
is_binary
that relies on main capabilities, and optimized to detect binaries - Propagate
enable_fallback
argument throughoutfrom_bytes
,from_path
, andfrom_fp
that allow a deeper control over the detection (default True) - Explicit support for Python 3.12
- Edge case detection failure where a file would contain ‘very-long’ camel cased word (Issue #289) https://redirect.github.com/Ousret/charset_normalizer/issues/289″>#289)
- Argument
should_rename_legacy
for legacy functiondetect
and disregard any new arguments without errors (PR #262) https://redirect.github.com/Ousret/charset_normalizer/issues/262″>#262)
- Support for Python 3.6 (PR #260) https://redirect.github.com/Ousret/charset_normalizer/issues/260″>#260)
- Optional speedup provided by mypy/c 1.0.1
- Multi-bytes cutter/chunk generator did not always cut correctly (PR #233) https://redirect.github.com/Ousret/charset_normalizer/issues/233″>#233)
- Speedup provided by mypy/c 0.990 on Python >= 3.7
- Extend the capability of explain=True when cp_isolation contains at most two entries (min one), will log in details of the Mess-detector results
- Support for alternative language frequency set in charset_normalizer.assets.FREQUENCIES
- Add parameter
language_threshold
infrom_bytes
,from_path
andfrom_fp
to adjust the minimum expected coherence ratio normalizer --version
now specify if current version provide extra speedup (meaning mypyc compilation whl)
- Build with static metadata using ‘build’ frontend
- Make the language detection stricter
- Optional: Module
md.py
can be compiled using Mypyc to provide an extra speedup up to 4x faster than v2.1
- CLI with opt —normalize fail when using full path for files
- TooManyAccentuatedPlugin induce false positive on the mess detection when too few alpha character have been fed to it
- Sphinx warnings when generating the documentation
- If you are using the legacy
detect
function, that is it. You have nothing to do.
0424c80
https://github.com/Ousret/charset_normalizer/commit/0424c805c968d81f90281bf1ea0c7a1cd15b0281″>0424c80
Add workflow_call for ci.yml workflow (reusable) (#307) https://redirect.github.com/Ousret/charset_normalizer/issues/307″>#307) 782885e
https://github.com/Ousret/charset_normalizer/commit/782885e789f0e97fbda796255a3bac5ec4cd656f»>782885e
Fix issue 289, add function is_binary, add explicit support py 3.12 (#306) https://redirect.github.com/Ousret/charset_normalizer/issues/306″>#306) 1b0fb5c
https://github.com/Ousret/charset_normalizer/commit/1b0fb5cb06bb0e89bf47b954757fe664e5cd2e0d»>1b0fb5c
⬆️ Bump pytest from 7.3.2 to 7.4.0 (#304) https://redirect.github.com/Ousret/charset_normalizer/issues/304″>#304) 3acf08e
https://github.com/Ousret/charset_normalizer/commit/3acf08eac971a76fe6e2b6f6d950289e7c2a0ff3″>3acf08e
⬆️ Bump mypy from 1.3.0 to 1.4.1 (#305) https://redirect.github.com/Ousret/charset_normalizer/issues/305″>#305) 5c030b5
https://github.com/Ousret/charset_normalizer/commit/5c030b5e6f000bac2b923e3035b705ffb0d7c835″>5c030b5
Replace emoji shortcodes with UTF-8 emoji (#303) https://redirect.github.com/Ousret/charset_normalizer/issues/303″>#303) f9f686b
https://github.com/Ousret/charset_normalizer/commit/f9f686b1d6d3cf791e989cb64a0d121d42365473″>f9f686b
⬆️ Bump pypa/cibuildwheel from 2.13.0 to 2.13.1 (#302) https://redirect.github.com/Ousret/charset_normalizer/issues/302″>#302) d42cdaf
https://github.com/Ousret/charset_normalizer/commit/d42cdaf80c391b01f3c0f6d89fcdbdf4ae55018b»>d42cdaf
⬆️ Bump slsa-framework/slsa-github-generator from 1.6.0 to 1.7.0 (#301) https://redirect.github.com/Ousret/charset_normalizer/issues/301″>#301) f8e7db1
https://github.com/Ousret/charset_normalizer/commit/f8e7db1df076492957aa4088d85c3a586a14b10a»>f8e7db1
⬆️ Bump pytest from 7.3.1 to 7.3.2 (#300) https://redirect.github.com/Ousret/charset_normalizer/issues/300″>#300) 6f02962
https://github.com/Ousret/charset_normalizer/commit/6f029624ee63d96175af84c233fa4c4a069e7001″>6f02962
⬆️ Bump pytest-cov from 4.0.0 to 4.1.0 (#298) https://redirect.github.com/Ousret/charset_normalizer/issues/298″>#298) 8028c56
https://github.com/Ousret/charset_normalizer/commit/8028c56fb5c1e640cb81371e451b498770825880″>8028c56
⬆️ Bump pypa/cibuildwheel from 2.12.3 to 2.13.0 (#299) https://redirect.github.com/Ousret/charset_normalizer/issues/299″>#299) - Additional commits viewable in compare»>https://github.com/Ousret/charset_normalizer/compare/2.0.12. 3.2.0″>compare view
Welcome to AIOHTTP¶
Asynchronous HTTP Client/Server for asyncio and Python.
Key Features¶
- Supports both Client and HTTP Server .
- Supports both Server WebSockets and Client WebSockets out-of-the-box without the Callback Hell.
- Web-server has Middlewares , Signals and plugable routing.
Library Installation¶
You may want to install optional cchardet library as faster replacement for charset-normalizer :
Note that the cchardet project is known not to support Python 3.10 or higher. See #6819 and GitHub: PyYoshi/cChardet/issues/77 for more details.
For speeding up DNS resolving by client API you may install aiodns as well. This option is highly recommended:
Installing all speedups in one command¶
The following will get you aiohttp along with cchardet , aiodns and Brotli in one bundle. No need to type separate commands anymore!
$ pip install aiohttp[speedups]
Getting Started¶
Client example¶
import aiohttp import asyncio async def main(): async with aiohttp.ClientSession() as session: async with session.get('http://python.org') as response: print("Status:", response.status) print("Content-type:", response.headers['content-type']) html = await response.text() print("Body:", html[:15], ". ") asyncio.run(main())
Status: 200 Content-type: text/html; charset=utf-8 Body: .
Server example:¶
from aiohttp import web async def handle(request): name = request.match_info.get('name', "Anonymous") text = "Hello, " + name return web.Response(text=text) app = web.Application() app.add_routes([web.get('/', handle), web.get('/ ', handle)]) if __name__ == '__main__': web.run_app(app)
For more information please visit Client and Server pages.
What’s new in aiohttp 3?¶
Go to What’s new in aiohttp 3.0 page for aiohttp 3.0 major release changes.
Tutorial¶
Source code¶
Please feel free to file an issue on the bug tracker if you have found a bug or have some suggestion in order to improve the library.
Dependencies¶
- Python 3.6+
- async_timeout
- attrs
- charset-normalizer
- multidict
- yarl
- Optionalcchardet as faster replacement for charset-normalizer . Install it explicitly via:
Communication channels¶
Feel free to post your questions and ideas here.
We support Stack Overflow. Please add aiohttp tag to your question there.
Contributing¶
Please read the instructions for contributors before making a Pull Request.
Authors and License¶
The aiohttp package is written mostly by Nikolay Kim and Andrew Svetlov.
It’s Apache 2 licensed and freely available.
Feel free to improve this package and send a pull request to GitHub.
Policy for Backward Incompatible Changes¶
aiohttp keeps backward compatibility.
After deprecating some Public API (method, class, function argument, etc.) the library guaranties the usage of deprecated API is still allowed at least for a year and half after publishing new release with deprecation.
All deprecations are reflected in documentation and raises DeprecationWarning .
Sometimes we are forced to break the own rule for sake of very strong reason. Most likely the reason is a critical bug which cannot be solved without major API change, but we are working hard for keeping these changes as rare as possible.
Table Of Contents¶
- Client
- Quickstart
- Advanced Usage
- Reference
- Tracing Reference
- The aiohttp Request Lifecycle
- Tutorial
- Quickstart
- Advanced Usage
- Low Level
- Reference
- Logging
- Testing
- Deployment
- Abstract Base Classes
- Working with Multipart
- Multipart reference
- Streaming API
- Common data structures
- WebSocket utilities
- Are there plans for an @app.route decorator like in Flask?
- Does aiohttp have a concept like Flask’s “blueprint” or Django’s “app”?
- How do I create a route that matches urls with a given prefix?
- Where do I put my database connection so handlers can access it?
- How can middleware store data for web handlers to use?
- Can a handler receive incoming events from different sources in parallel?
- How do I programmatically close a WebSocket server-side?
- How do I make a request from a specific IP address?
- What is the API stability and deprecation policy?
- How do I enable gzip compression globally for my entire application?
- How do I manage a ClientSession within a web server?
- How do I access database connections from a subapplication?
- How do I perform operations in a request handler after sending the response?
- How do I make sure my custom middleware response will behave correctly?
- Why is creating a ClientSession outside of an event loop dangerous?
- Essays
- Glossary
- Changelog
- Indices and tables
- Third-Party libraries
- Built with aiohttp
- Powered by aiohttp
- Instructions for contributors
- Preconditions for running aiohttp test suite
- LLHTTP
- Run autoformatter
- Run aiohttp test suite
- Tests coverage
- Documentation
- Spell checking
- Changelog update
- Making a Pull Request
- Backporting
- How to become an aiohttp committer
aiohttp
Async HTTP client/server for asyncio and Python