requests downloader middleware for scrapy, send request by requests.
Project description
Scrapy Requests Downloader Middleware
This package will make scrapy support requests. Everything is same with requests.
Installation
pip3 install scrapy-requests-manipulate
Usage
After add this middleware, all requests will be sent by requests.
The usage is very simple, for request, specify params in meta.
Settings for Request
params = {
'key1': 'value1',
'key2': 'value2',
}
data = {
'key1': 'value1',
'key2': 'value2',
}
# turn cookie jar into dict, and remove the " mark, use ' mark
cookies = {
'key1': 'value1',
'key2': 'value2',
}
payload = {
'key1': 'value1',
'key2': 'value2'
}
proxy_ = 'http://username:password@ip:port' # https also works
or
proxy_ = [
'http://username:password@ip:port',
'http://username:password@ip:port',
] # if the type of proxy is list, every request will get a random proxy in the list
meta_data = {
'params': params,
'data': data,
'cookies': cookies,
'json': payload,
'proxy_': proxy_
}
or
meta_data = {
'params': json.dumps(params),
'data': json.dumps(data),
'cookies': json.dumps(cookies),
'json': json.dumps(payload),
'proxy_': json.dumps(proxy_)
}
yield scrapy.Request(url=url, headers=headers, meta=meta_data)
And you also need to enable RequestsDownloaderMiddleware in DOWNLOADER_MIDDLEWARES:
DOWNLOADER_MIDDLEWARES = {
'scrapy_requests.downloaderMiddleware.RequestsDownloaderMiddleware': 543,
}
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scrapy-requests-manipulate-0.0.1.tar.gz.
File metadata
- Download URL: scrapy-requests-manipulate-0.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74cd198d74a1c1784ace9233a44d0855e77b0b181b0b1b4ecab3d50a0e9069c7
|
|
| MD5 |
fb4020db44ab8418621900aad7cd1f37
|
|
| BLAKE2b-256 |
2f76704152a0eeda9ef8df21144ae919fe79bce61ab5165b920305caa3bb1631
|
File details
Details for the file scrapy_requests_manipulate-0.0.1-py3-none-any.whl.
File metadata
- Download URL: scrapy_requests_manipulate-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ede3b3fcc1fcfe04ecd3e51abe62bd6a40f95eca47783620257822b100bf3d6d
|
|
| MD5 |
4423785e281b99bdc5528becf4d8d0d6
|
|
| BLAKE2b-256 |
19dd2c1e86d8264e0193238d4576bc0dd34fae37cbcaa1e79c17899ad2bdcc39
|