Skip to main content

Wrapper for urllib.request.urlopen

Project description

URL Request

wrapper for urllib.request.urlopen

Very limited drop-in replacement for requests when you cant import requests and need to use the built in urllib.request library

Can be used via pip or just copy the class into your project

pip install urlrequest
from urlrequest import UrlRequest # as requests
response = UrlRequest('https://httpbin.org/ip')
print(response.text)
print(response.status_code)
print(response.headers)
print(response.json)

response = UrlRequest("https://httpbin.org/basic-auth/user/password",auth=('user','password'))
print(response.text)

response = UrlRequest("https://httpbin.org/post",method="POST",json={"hello":"world"})
print(response.text)

response = UrlRequest("https://httpbin.org/image/png")
with open("test.png","wb") as f:
    f.write(response.raw)
print(response.status_code)

# drop in for requests
response = UrlRequest.get("https://httpbin.org/headers",headers={"hello":"world header test"})
print(response.text)

Project details


Download files

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

Source Distribution

urlrequest-1.0.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

urlrequest-1.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file urlrequest-1.0.0.tar.gz.

File metadata

  • Download URL: urlrequest-1.0.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for urlrequest-1.0.0.tar.gz
Algorithm Hash digest
SHA256 46b647e0f7971980aa1e2c9e500eca6fe554cd8199b9f1b9a85594084f696217
MD5 335263cac1b6188a89792b2fd0a91081
BLAKE2b-256 612efa3da76d25de825f520eb933ef99b9c5337a521a20a55f2fa5eeeb5ac644

See more details on using hashes here.

File details

Details for the file urlrequest-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: urlrequest-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for urlrequest-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce5b5fbe00bbee150478517581fdd40d348ed6073425f8309c1c2ad33d370d80
MD5 07659779153ccbc09d89b39d0b448925
BLAKE2b-256 5136b80b790f6acd9544c14dc4216d713d347a7a893e9a293515b116657068aa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page