Using aiohttp to send GET requests in Python (2 examples)
Updated: Aug 16, 2023
aiohttp is an open-source library that provides an asynchronous HTTP client and server. It is based on the asyncio module and supports both HTTP/1.1 and HTTP/2 protocols. This easy-to-understand article will walk you through the steps to......
How to Setup Python Virtual Environments (venv)
Updated: Aug 11, 2023
This tutorial shows you how to set up and manage a Python virtual environment. What is a Virtual Environment? A Python virtual environment is an environment where the Python interpreter, libraries, and scripts installed into it are......
Python: Add a coroutine to an already running event loop
Updated: Aug 10, 2023
This concise, exampled-base article walks you through some different ways to add a coroutine to an already running event loop in Python. Using the asyncio.loop.create_task() method This approach uses the loop.create_task() method,......
Python asyncio.run_coroutine_threadsafe() function (with examples)
Updated: Aug 10, 2023
This succinct, example-based article is about the asyncio.run_coroutine_threadsafe() function in Python. The fundamentals asyncio.run_coroutine_threadsafe() was added to the Python programming language in version 3.4.4. The function......
Python asyncio.loop.create_server() method (with examples)
Updated: Aug 10, 2023
This succinct, straight-to-the-point article is about the asyncio.loop.create_server() method in Python. The Fundamentals The asyncio.loop.create_server() method was added to the Python standard library in version 3.4, as part of......
Python: Using aiohttp to crawl webpages asynchronously
Updated: Aug 08, 2023
This concise, code-centric article will show you how to asynchronously crawl a single or a list of webpages by using aiohttp and BeautifulSoup 4 in Python. Overview async/await async/await is a way of writing asynchronous code in......
Python asyncio.Semaphore class (with examples)
Updated: Aug 07, 2023
This succinct, practice-oriented article is about the asyncio.Semaphore class in Python. The Fundamentals The asyncio.Semaphore class is used to implement a semaphore object for asyncio tasks. A semaphore is a synchronization......
Python asyncio.as_completed() function (with examples)
Updated: Aug 07, 2023
In this concise and code-centric article, you’ll learn about the asyncio._as_completed() function in Python (Python 3.4 or newer is required). Overview The asyncio.as_completed() function is used to run a collection of tasks......
Python asyncio.create_task() function (with examples)
Updated: Aug 07, 2023
This concise, example-oriented article is about the asyncio.create_task() function in Python. Overview asyncio.create_task() is a high-level function that was added to Python in version 3.7. The function is used for running......
Python asyncio.loop.run_until_complete() function (with examples)
Updated: Aug 04, 2023
This pithy, straight-to-the-point article is about the asyncio.loop.run_until_complete() method in modern Python programming (with async/await). Overview The asyncio.loop.run_until_complete() method was added to Python in version......
Python SyntaxError: ‘await’ outside async function
Updated: Aug 04, 2023
This concise article is about a common error you might run into when writing asynchronous code in Python: SyntaxError: 'await' outside async function Understanding the Problem await is used in an async function or method to wait......
Python asyncio: Run a task at a certain time every day (2 examples)
Updated: Aug 04, 2023
By using Python, you can build a small (or large) system that can automatically do some monotonous and repetitive tasks at a certain time every day (maybe at midnight, when you’re sleeping), such as backing up files or databases,......