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.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for urlrequest-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b160cc42d9f1878200704673e0ddad7cd83d451e36bee31ffa981f020dcff26e
MD5 500840ddcec88889cd7655371f855f5c
BLAKE2b-256 5d26e454aaac2dad4fc20fbb7e3e91fd6c77d88b24800d61f9fd4819d91322ad

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for urlrequest-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9f06e969812438c55a664c7aa7c595c99ca450a4b0c89cf792c4f66235187712
MD5 1bf53666f3e1915fb42bdf48ada7b2a3
BLAKE2b-256 7102ae92e3c43c6f65fab6c97a0a7e68f03c5b45eebfde772a7b734a78bb27c0

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