mirror of https://github.com/scrapy/scrapy.git
UriUserinfo → UriUserInfo
This commit is contained in:
parent
98207f8f16
commit
0bd1918ac8
|
|
@ -332,7 +332,7 @@ HttpAuthMiddleware
|
|||
|
||||
You can alternatively specify ``http_user`` and ``http_pass`` in
|
||||
:attr:`Request.meta <scrapy.http.Request.meta>`, or use
|
||||
:class:`~scrapy.downloadermiddlewares.uriuserinfo.UriUserinfoMiddleware`.
|
||||
:class:`~scrapy.downloadermiddlewares.uriuserinfo.UriUserInfoMiddleware`.
|
||||
|
||||
.. _Basic access authentication: https://en.wikipedia.org/wiki/Basic_access_authentication
|
||||
|
||||
|
|
@ -1140,13 +1140,13 @@ DownloaderStats
|
|||
setting.
|
||||
|
||||
|
||||
UriUserinfoMiddleware
|
||||
UriUserInfoMiddleware
|
||||
---------------------
|
||||
|
||||
.. module:: scrapy.downloadermiddlewares.uriuserinfo
|
||||
:synopsis: URI Userinfo Middleware
|
||||
|
||||
.. autoclass:: UriUserinfoMiddleware
|
||||
.. autoclass:: UriUserInfoMiddleware
|
||||
|
||||
|
||||
UserAgentMiddleware
|
||||
|
|
|
|||
|
|
@ -534,7 +534,7 @@ Default::
|
|||
|
||||
{
|
||||
'scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware': 100,
|
||||
'scrapy.downloadermiddlewares.uriuserinfo.UriUserinfoMiddleware': 200,
|
||||
'scrapy.downloadermiddlewares.uriuserinfo.UriUserInfoMiddleware': 200,
|
||||
'scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware': 300,
|
||||
'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware': 350,
|
||||
'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware': 400,
|
||||
|
|
@ -824,7 +824,7 @@ It can be overriden in a request in any of the following ways:
|
|||
- Specifying ``ftp_password`` in :attr:`Request.meta <scrapy.http.Request.meta>`
|
||||
|
||||
- Specifying the password in :attr:`Request.url <scrapy.http.Request.url>`
|
||||
(see :class:`~scrapy.downloadermiddlewares.uriuserinfo.UriUserinfoMiddleware`)
|
||||
(see :class:`~scrapy.downloadermiddlewares.uriuserinfo.UriUserInfoMiddleware`)
|
||||
|
||||
.. note::
|
||||
Paraphrasing `RFC 1635`_, although it is common to use either the password
|
||||
|
|
@ -849,7 +849,7 @@ It can be overriden in a request in any of the following ways:
|
|||
- Specifying ``ftp_user`` in :attr:`Request.meta <scrapy.http.Request.meta>`
|
||||
|
||||
- Specifying the username in :attr:`Request.url <scrapy.http.Request.url>`
|
||||
(see :class:`~scrapy.downloadermiddlewares.uriuserinfo.UriUserinfoMiddleware`)
|
||||
(see :class:`~scrapy.downloadermiddlewares.uriuserinfo.UriUserInfoMiddleware`)
|
||||
|
||||
.. setting:: ITEM_PIPELINES
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from urllib.parse import unquote, urlunparse
|
|||
from scrapy.utils.httpobj import urlparse_cached
|
||||
|
||||
|
||||
class UriUserinfoMiddleware:
|
||||
class UriUserInfoMiddleware:
|
||||
"""Downloader middleware that replaces `URI userinfo`_ data (user credentials
|
||||
for HTTP or FTP specified in the request URL) with the corresponding meta
|
||||
keys for later middlewares or download handlers to use them for
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ DOWNLOADER_MIDDLEWARES = {}
|
|||
DOWNLOADER_MIDDLEWARES_BASE = {
|
||||
# Engine side
|
||||
'scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware': 100,
|
||||
'scrapy.downloadermiddlewares.uriuserinfo.UriUserinfoMiddleware': 200,
|
||||
'scrapy.downloadermiddlewares.uriuserinfo.UriUserInfoMiddleware': 200,
|
||||
'scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware': 300,
|
||||
'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware': 350,
|
||||
'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware': 400,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import unittest
|
||||
|
||||
from scrapy.http import Request
|
||||
from scrapy.downloadermiddlewares.uriuserinfo import UriUserinfoMiddleware
|
||||
from scrapy.downloadermiddlewares.uriuserinfo import UriUserInfoMiddleware
|
||||
from scrapy.spiders import Spider
|
||||
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ class BaseTestCase:
|
|||
class Implementation(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.mw = UriUserinfoMiddleware()
|
||||
self.mw = UriUserInfoMiddleware()
|
||||
self.spider = Spider('bar')
|
||||
|
||||
def tearDown(self):
|
||||
|
|
@ -65,19 +65,19 @@ class BaseTestCase:
|
|||
self.assertEqual(req.meta[self.password_field], 'b@r')
|
||||
|
||||
|
||||
class UriUserinfoMiddlewareFTPTest(BaseTestCase.Implementation):
|
||||
class UriUserInfoMiddlewareFTPTest(BaseTestCase.Implementation):
|
||||
protocol = 'ftp'
|
||||
username_field = 'ftp_user'
|
||||
password_field = 'ftp_password'
|
||||
|
||||
|
||||
class UriUserinfoMiddlewareHTTPTest(BaseTestCase.Implementation):
|
||||
class UriUserInfoMiddlewareHTTPTest(BaseTestCase.Implementation):
|
||||
protocol = 'http'
|
||||
username_field = 'http_user'
|
||||
password_field = 'http_pass'
|
||||
|
||||
|
||||
class UriUserinfoMiddlewareHTTPSTest(BaseTestCase.Implementation):
|
||||
class UriUserInfoMiddlewareHTTPSTest(BaseTestCase.Implementation):
|
||||
protocol = 'https'
|
||||
username_field = 'http_user'
|
||||
password_field = 'http_pass'
|
||||
|
|
|
|||
Loading…
Reference in New Issue