Skip to main content

A simple wrapper of requests, easy but useful!

Project description

A simple wrapper of requests, easy but useful!

Installation

pip install webrequests

Features

  • Random User-Agent automatic
  • Try again when request failed
  • Download file from an URL
  • Get a soup from an URL

Usage

from webrequests import WebRequest


url = 'http://output.nsfc.gov.cn/captcha/defaultCaptcha'

# request an url
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
WebRequest.download(url, 'out.jpg')
WebRequest.download(url, 'out.jpg', max_try=5, timeout=10)


# request with session
import requests

session = requests.session()
resp = WebRequest.get_response(url, session=session)
print(resp.cookies)
print(session.cookies)


# get a soup
url = 'http://www.cip.cc/'
soup = WebRequest.get_soup(url)
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.4.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

webrequests-1.0.4-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: webrequests-1.0.4.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8

File hashes

Hashes for webrequests-1.0.4.tar.gz
Algorithm Hash digest
SHA256 f1845aeae5906faa28475375b6c6ed36d354b43b3fe3626576bf9361236056e6
MD5 881873c4e6191c1c8a60803a21aa18dd
BLAKE2b-256 adc057ea0fdc5526469f86d8093805ed20e304d460b5ae50680c2d4fe9f075af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: webrequests-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8

File hashes

Hashes for webrequests-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 66270c7f6e1c8717ca24f552bdbbac7a7625b6892816f855c002fa906495a283
MD5 cbc4518fdbdfff35a51ae863b58539ba
BLAKE2b-256 338bbb6236fcb301ab4e259cb498426377cd79081ab34e6187a7a8a4c5cbc164

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