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.8.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file webrequests-1.0.8.tar.gz
.
File metadata
- Download URL: webrequests-1.0.8.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5343b73ddc8edd28a119788a7ce85878c02b47c8aa4c121e8ef440697dae1667 |
|
MD5 | 9793e6a5061b548af3fd828f6204fea0 |
|
BLAKE2b-256 | a0ad6da580ea58b0cbb4e678cfcf58beb3855fa214422079c1ee573d2c9b6050 |
File details
Details for the file webrequests-1.0.8-py3-none-any.whl
.
File metadata
- Download URL: webrequests-1.0.8-py3-none-any.whl
- Upload date:
- Size: 4.7 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 | e4024e15dd14a59ea5a8425de3da194f212d7d1bee2bedf036fa492d37d8b93e |
|
MD5 | 0231c3f8c7fb5ab2cd469774a02bc3ba |
|
BLAKE2b-256 | 722a90d14fb7e0ba6e19d80e9f878396c25d390b50480c3998354abbacb8b8f5 |