Python

How to set timeouts when using aiohttp in Python

Updated: August 19, 2023 By: Khue

aiohttp is an open-source Python library that can be used to make HTTP requests asynchronously (with the async/await syntax). A timeout is a limit on how much time…

Using aiohttp to send GET requests in Python (2 examples)

Updated: August 16, 2023 By: Khue

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…

Python: Add a coroutine to an already running event loop

Updated: August 10, 2023 By: Wolf

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…

Python asyncio.loop.create_server() method (with examples)

Updated: August 10, 2023 By: Khue

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…

Python: Using aiohttp to crawl webpages asynchronously

Updated: August 8, 2023 By: Goodman

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…

Python asyncio.Semaphore class (with examples)

Updated: August 7, 2023 By: Khue

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…

Python asyncio.as_completed() function (with examples)

Updated: August 7, 2023 By: Khue

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…

Python asyncio.create_task() function (with examples)

Updated: August 7, 2023 By: Khue

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…

Python asyncio.loop.run_until_complete() function (with examples)

Updated: August 4, 2023 By: Wolf

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 3.4, as part…

Python SyntaxError: ‘await’ outside async function

Updated: August 4, 2023 By: Khue

This concise article is about a common error you might run into when writing asynchronous code in Python: Understanding the Problem await is used in an async function…

1 45 46 47 48 49 64