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())
Metadata
Release files for webrequests 1.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| webrequests-1.0.8.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| webrequests-1.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / webrequests-1.0.8.tar.gz
| Download URL | webrequests-1.0.8.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5343b73ddc8edd28a119788a7ce85878c02b47c8aa4c121e8ef440697dae1667
|
|
BLAKE2b-256 checksum How to use checksums |
a0ad6da580ea58b0cbb4e678cfcf58beb3855fa214422079c1ee573d2c9b6050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|
Release files / webrequests-1.0.8-py3-none-any.whl
| Download URL | webrequests-1.0.8-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4024e15dd14a59ea5a8425de3da194f212d7d1bee2bedf036fa492d37d8b93e
|
|
BLAKE2b-256 checksum How to use checksums |
722a90d14fb7e0ba6e19d80e9f878396c25d390b50480c3998354abbacb8b8f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|