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
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.6.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file webrequests-1.0.6.tar.gz
.
File metadata
- Download URL: webrequests-1.0.6.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 793dd94ef6a68901593714aebcefed8262797f2a5109258d5a4ca1122f24b858 |
|
MD5 | 7f39a2b77eb15dd6499802318c9c45af |
|
BLAKE2b-256 | c805f2dcf68a2c661503c02d05ef33d32d1a1f4aab9fc541741002c5bfb0ed33 |
File details
Details for the file webrequests-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: webrequests-1.0.6-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bbe2b3d0fffe9a611fb07db1516363f7edccbb298de6ed07d84e3c09adc1114 |
|
MD5 | de0ca922107bef75b4dedc335a92a761 |
|
BLAKE2b-256 | f3d11fc01d0297d5a18a46a52c92a459589880d8a3ea7222b2491d1dee86dcd6 |