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

Uploaded Source

Built Distribution

urlrequest-1.0.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: urlrequest-1.0.1.tar.gz
  • Upload date:
  • Size: 3.6 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.1.tar.gz
Algorithm Hash digest
SHA256 aec0e75f96faaec62a7f2d5de64c012747af22ed36c8fa239d5c8693c60f417c
MD5 0c6ecab7b03cc7312220ad89a7f2478b
BLAKE2b-256 da9547881eaa3c8df51914a6a8ecfe5cf79bb7d59d53993e0c412112e72a9035

See more details on using hashes here.

File details

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

File metadata

  • Download URL: urlrequest-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a8eed49d1bd9774d24a316e53f8c6c88974027edf2e3c65e76b0e4ab00e8af81
MD5 cf8f86caca350f5a642ebef7bbaa9577
BLAKE2b-256 072604c36ea0ca00a42dc0eec522e0485482629a469b513ce33fe464c6e1c246

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