1.在Scrapy工程下新建“middlewares.py”
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Importing base64 library because we'll need it ONLY in case if the proxy we are going to use requires authentication
import base64
# Start your middleware class
class ProxyMiddleware(object):
# overwrite process request
def process_request(self, request, spider):...