File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -59,16 +59,17 @@ def open_url(self, url):
5959
6060 This method has no support for cookies or any special authentication
6161 methods. If you need these, you have to provide your own custom URL
62- opener. The method has to return an object which supports the
63- `read()` and `readline()` methods to access the content. Example::
62+ opener. Overwrite open_url() with a method that receives an
63+ urllib.Request object and returns a ByteIO-like object or a
64+ requests.Response.
6465
65- def my_open_url(self, url) :
66- opener = urlrequest.build_opener()
67- opener.addheaders = [('X-Fancy-Header', 'important_content')]
68- return opener.open(url)
66+ Example: :
67+
68+ opener = urlrequest.build_opener()
69+ opener.addheaders = [('X-Fancy-Header', 'important_content')]
6970
7071 svr = ReplicationServer()
71- svr.open_url = my_open_url
72+ svr.open_url = opener.open
7273 """
7374 headers = dict ()
7475 for h in url .header_items ():
You can’t perform that action at this time.
0 commit comments