Skip to main content

urlfetch is a simple, lightweight and easy to use HTTP client for Python. It is distributed as a single file module and has no depencencies other than the Python Standard Library.

Highlights

  • Distributed as a single file module, has no depencencies other than the Python Standard Library.

  • Pure Python, works fine with gevent.

  • Small codebase, about 1000 lines and 30% are 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. If the tests are run by calling python setup.py test, the dependencies will be handled automatically (via tests_require). So, if you want to run the tests directly, that is, python tests/testall.py, make sure bottle and gunicorn are installed under the PYTHONPATH.

Releasing

Pushing a version tag publishes the package to PyPI with Trusted Publishing and creates a GitHub Release. The tag must match urlfetch.__version__ (for example v2.0.1).

git tag vX.Y.Z
git push origin vX.Y.Z

Release notes come from the matching section in doc/changelog.rst, followed by GitHub’s auto-generated notes. sdist and wheel are attached to the release.

One-time PyPI setup (project owner)

On https://pypi.org/manage/project/urlfetch/settings/publishing/ add a GitHub Trusted Publisher:

  • Owner: ifduyue

  • Repository: urlfetch

  • Workflow: publish.yml

  • Environment: pypi

The GitHub environment pypi is restricted to tags matching v*. No PyPI API token is stored in the repository.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

urlfetch-2.0.2.tar.gz (73.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

urlfetch-2.0.2-py3-none-any.whl (70.4 kB view details)

Uploaded Python 3

File details

Details for the file urlfetch-2.0.2.tar.gz.

File metadata

  • Download URL: urlfetch-2.0.2.tar.gz
  • Upload date:
  • Size: 73.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for urlfetch-2.0.2.tar.gz
Algorithm Hash digest
SHA256 f778b19c520b8833a6149adc741b0950d20ca98c1c6b7d8a52f80e0090e3367c
MD5 f0f77769d6bdabca355a0b88c1375326
BLAKE2b-256 cb313887ae69b12d5f38ade975dcd9b7e931e9cf25798581dd3fbafa6ea0dbd9

See more details on using hashes here.

Provenance

The following attestation bundles were made for urlfetch-2.0.2.tar.gz:

Publisher: publish.yml on ifduyue/urlfetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file urlfetch-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: urlfetch-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 70.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for urlfetch-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fd7b204788d3bfa9a0504ebb096b7a0726e38ac8c9805b17322a3a7d35702c31
MD5 df6269a24850f0f336bbbfaffcf57655
BLAKE2b-256 c81c7d38f362a776ea0c92669290f27e87e0474b8a10be86fa6d6127f05ac5c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for urlfetch-2.0.2-py3-none-any.whl:

Publisher: publish.yml on ifduyue/urlfetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

3.0.0

2 files

2.4.1

2 files

2.4.0

2 files

2.3.0

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.3

2 files

This release

2.0.2 This release

2 files

2.0.1

1 file

2.0.0

1 file

1.2.2

1 file

1.2.1

1 file

1.2.0

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.3

1 file

1.0.2

3 files

1.0.1

1.0

3 files

0.6.2

3 files

0.6.1

3 files

0.6

3 files

0.5.7

3 files

0.5.6

1 file

0.5.5

1 file

0.5.4.2

1 file

0.5.4.1

1 file

0.5.4

1 file

0.5.3.1

1 file

0.5.3

1 file

0.5.2

1 file

0.5.1

3 files

0.5.0

3 files

0.4.3

3 files

0.4.2

3 files

0.4.1

3 files

0.4.0

3 files

0.3.7

3 files

0.3.6

3 files

0.3.5

3 files

0.3.4

3 files

0.3.3

3 files

0.3.2

3 files

0.3.1

3 files

0.3.0

3 files

0.2.2

3 files

0.2.1

3 files

0.2

3 files

0.1.11

3 files

0.1.7

3 files

0.1.6

3 files

0.1.5

3 files

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1

1 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