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.7.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file webrequests-1.0.7.tar.gz
.
File metadata
- Download URL: webrequests-1.0.7.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a7432a087a3693fe52b2481aad61ed5204623aa482033000ad45e8a983b56ef |
|
MD5 | c98d20ed7c565356578187295819d2b8 |
|
BLAKE2b-256 | 889f20fb8f5565f2f769b665ed0c1543acaf11a1291f84f660eddf0c84184fe8 |
File details
Details for the file webrequests-1.0.7-py3-none-any.whl
.
File metadata
- Download URL: webrequests-1.0.7-py3-none-any.whl
- Upload date:
- Size: 4.6 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 | 72bf14dd774ca95e56d5cdc2d7182968b4618ecbbb0fb7dcfab31b5c000c9822 |
|
MD5 | c7badeeefe5274ec641f43ce79d93d41 |
|
BLAKE2b-256 | 5bc9849c6e58228240ad647d97ca44c0ce57ca909f9dcc435d0287f1873fe1e1 |