A simple wrapper of requests
Project description
A simple wrapper of requests
Installation
pip install webrequests
Usage
from webrequests import WebRequest
url = 'http://output.nsfc.gov.cn/captcha/defaultCaptcha'
# request an url
resp = WebRequst.get_response(url)
resp = WebRequst.get_response(url, method='POST', max_try=5, timeout=5)
print(resp.headers)
# download file from an url
WebRequst.download(url, 'out.jpg')
WebRequst.download(url, 'out.jpg', max_try=5, timeout=10)
# request with session
import requests
session = requests.session()
resp = WebRequst.get_response(url, session=session)
print(resp.cookies)
print(session.cookies)
# get a soup
url = 'http://www.cip.cc/'
soup = WebRequst.get_soup(url)
print(soup.select_one('.kq-well pre').text.strip())
Project details
Release history Release notifications | RSS feed
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.0.tar.gz
(2.8 kB
view details)
File details
Details for the file webrequests-1.0.0.tar.gz
.
File metadata
- Download URL: webrequests-1.0.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a940d1021b6f2aed9c6e0dc79886306019487cef0f2e71bb0106aca468e372fa |
|
MD5 | aa281a0a5bcf24307194956de38d3bca |
|
BLAKE2b-256 | db47bab3df4a31ced9d3505cfddf40ac9a7892bb5448685c72c98f05d79e1140 |