Skip to main content

A simple wrapper of requests, simple but useful!

Project description

A simple wrapper of requests, simple but useful!

Installation

pip install webrequests

Features

  • Random User-Agent
  • Try again when request failed
  • Download file from an url, with progress bar
  • Get a BeautifulSoup from an url

Usage

from webrequests import WebRequest


# request an url
url = 'http://output.nsfc.gov.cn/captcha/defaultCaptcha'
resp = WebRequest.get_response(url)
resp = WebRequest.get_response(url, method='POST', max_try=5, timeout=5)
print(resp.headers)


# download file from an url
url = 'https://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/hg19.fa.gz'
WebRequest.download(url)
WebRequest.download(url, 'out.jpg', max_try=5, timeout=10)


# request with session
session = requests.session()
resp = WebRequest.get_response('http://www.cip.cc/', session=session)
print(resp.cookies)
print(session.cookies)


# get a soup
soup = WebRequest.get_soup('http://www.cip.cc/')
print(soup.select_one('.kq-well pre').text.strip())

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

webrequests-1.0.5.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

webrequests-1.0.5-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file webrequests-1.0.5.tar.gz.

File metadata

  • Download URL: webrequests-1.0.5.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.3

File hashes

Hashes for webrequests-1.0.5.tar.gz
Algorithm Hash digest
SHA256 db4f7bfb5c96e7b638c14420f309e10b6dd47a7b3835d557d2af7b6aeb685144
MD5 8fb5695b4ced0241c33bf5dda6a512da
BLAKE2b-256 91629be2d499ed7fe9f545951d74f735712e542f74dfcaa19b7ce8a0df160b60

See more details on using hashes here.

File details

Details for the file webrequests-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: webrequests-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.3

File hashes

Hashes for webrequests-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 627b3795ed4146abba629502fc7ae6acf1bb2af0314d2172342aee708ae913f9
MD5 9a7318980f2ed3d1165d77247c22a52b
BLAKE2b-256 878637e3e6ed2518ad1ac5fd91492f1a5bd90c0486f4bc74a14a4a15a87cd364

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