urlfetch is a simple, lightweight and easy to use HTTP client for Python. It is distributed as a single file module and has no dependencies other than the Python Standard Library.
Highlights
Distributed as a single file module, has no dependencies other than the Python Standard Library.
Pure Python, works fine with gevent.
Small codebase, about 1300 lines, much of it comments and blank lines. Only 10 minutes you can know every detail.
Random user-agent.
Support streaming.
Installation
$ pip install urlfetch
Hello, world
import urlfetch
response = urlfetch.get('http://python.org/')
print(response.status, response.reason)
print(len(response.content))
Uploading files
import urlfetch
response = urlfetch.post(
'http://127.0.0.1:8888/upload',
headers = {
'Referer': 'http://127.0.0.1/',
},
files = {
'fieldname1': open('/path/to/file', 'rb'),
#'fieldname2': 'file content', # file must have a filename
'fieldname3': ('filename', open('/path/to/file2', 'rb')),
'fieldname4': ('filename', 'file content'),
},
data = {
'foo': 'bar'
},
)
print(response.status, response.content)
Testing
To run the tests, urlfetch relies on bottle and gunicorn. Install them and run:
$ python tests/testall.py
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file urlfetch-3.0.0.tar.gz.
File metadata
- Download URL: urlfetch-3.0.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b818d89a0251ed9b1a8c3820548784cf6f3dfdb14d93afdaece939984fce1a4
|
|
| MD5 |
b51d453ede6bef03a64abdc5082ac858
|
|
| BLAKE2b-256 |
270474ce9e4ad7fb7292b5b5c9919dda0049224f4af90365bff49c191df80c7a
|
Provenance
The following attestation bundles were made for urlfetch-3.0.0.tar.gz:
Publisher:
publish.yml on ifduyue/urlfetch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
urlfetch-3.0.0.tar.gz -
Subject digest:
3b818d89a0251ed9b1a8c3820548784cf6f3dfdb14d93afdaece939984fce1a4 - Sigstore transparency entry: 2581373186
- Sigstore integration time:
-
Permalink:
ifduyue/urlfetch@f082ece1c0bd49d95df8cf44275b2d4435749cd0 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/ifduyue
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f082ece1c0bd49d95df8cf44275b2d4435749cd0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file urlfetch-3.0.0-py3-none-any.whl.
File metadata
- Download URL: urlfetch-3.0.0-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ab5ed7f0cc89556c2211b031d5b30b40d1ecb0935b29e96c70337a098a7755d
|
|
| MD5 |
c9af2d9ec50427bf945f453e5616cb18
|
|
| BLAKE2b-256 |
f7942b4658c9394c3dcbef9dfa21e0fd0a3ba234547033d283a7ac51eac15b57
|
Provenance
The following attestation bundles were made for urlfetch-3.0.0-py3-none-any.whl:
Publisher:
publish.yml on ifduyue/urlfetch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
urlfetch-3.0.0-py3-none-any.whl -
Subject digest:
9ab5ed7f0cc89556c2211b031d5b30b40d1ecb0935b29e96c70337a098a7755d - Sigstore transparency entry: 2581373197
- Sigstore integration time:
-
Permalink:
ifduyue/urlfetch@f082ece1c0bd49d95df8cf44275b2d4435749cd0 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/ifduyue
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f082ece1c0bd49d95df8cf44275b2d4435749cd0 -
Trigger Event:
push
-
Statement type: