Skip to main content

What is this about?

Yieldfrom is a project to port various useful Python 3 libraries, both standard library and otherwise, to work under Asyncio. The intention is to have the port be as alike as possible to the original, so that the learning curve is minimal, and to make porting dependent modules as easy as possible.

This package is a port of the Urllib3 package.

Some functions, methods, and properties have become coroutines. This document itemizes those, with a few notes on how usage needs to be different. Other than what is mentioned here, the classes, methods and functions are all named the same and used the same.

Since the ‘yield from coroutine’ statements block the current method until the statement completes, this variant can be a statement-for-statement replacement for the original, and the architecture of the app is unchanged. No callbacks anywhere.

imports

Instead of importing like:

from urllib.connections import HTTPConnection from urllib import connections

use:

from yieldfrom.urllib.connections import HTTPConnection from yieldfrom.urllib import connections

Classes HTTPConnection and HTTPSConnection

The connect method is now a coroutine. Call it with yield from, like ‘c = yield from conn.connect(…)’, and otherwise the argument list is the same.

Classes HTTPConnectionPool, PoolManager, and ProxyManager

These classes all feature methods urlopen, request, request_encode_url, and request_encode_body , which have become coroutines. The argument list is unchanged, and the functionality is unchanged. Just call it with ‘yield from’ as a coroutine.

Class HTTPResponse

There is one new method, init() which is a coroutine. Its function was performed by the constructor in Urllib3, but needs to be async here. A coroutine constructor would be difficult, so the async portions are moved to the init() method. Run it as a coroutine after constructing an HTTPResponse. Generally, users of the module won’t be creating HTTPResponses directly, so this should not be much of an issue.

The read, readinto, stream methods are all coroutines. The data attribute is actually a property, now a coroutine, and should be referenced with the yield from syntax, like ‘d = yield from resp.data’.

The from_httplib classmethod is a coroutine also, though you probably won’t be using it directly.

The stream method does not actually stream, but preloads the body and simulates a stream for compatibility with modules and apps that use the method.

Otherwise

Other than the changes above, the API is the same as the original, and excellent documentation can be found at: URLLIB3 <http://urllib3.readthedocs.org>.

Changes

2014-12-29

version 0.1.2

Removed bug that caused false alarms on ‘unverified connection’ Fixed test imports to unambiguosly import yieldfrom modules bug fixes in tests.

2014-10-10

version 0.1.1

Converted to Asyncio

Metadata

Release files for yieldfrom.urllib3 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yieldfrom.urllib3 0.1.4
File Size Uploaded
yieldfrom.urllib3-0.1.4.zip 66.1 kB Details

Release files / yieldfrom.urllib3-0.1.4.zip

Download URL yieldfrom.urllib3-0.1.4.zip
Size 66.1 kB
Tags Source
SHA-256 checksum
How to use checksums
759f2ead636bfdeddabd0b440cd6396791977b27e6f3de44c15a81ee7da8bd63
BLAKE2b-256 checksum
How to use checksums
401c3417ef77d7b045441e7105dd2e344102a73c025fae1f2ddd8c0926ab982c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page