mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Make a new urllib package .
It consists of code from urllib, urllib2, urlparse, and robotparser. The old modules have all been removed. The new package has five submodules: urllib.parse, urllib.request, urllib.response, urllib.error, and urllib.robotparser. The urllib.request.urlopen() function uses the url opener from urllib2. Note that the unittests have not been renamed for the beta, but they will be renamed in the future. Joint work with Senthil Kumaran.
This commit is contained in:
parent
a656d2cd89
commit
1afc169616
40 changed files with 3190 additions and 3536 deletions
|
@ -50,7 +50,7 @@ def guess_scheme(environ):
|
|||
def application_uri(environ):
|
||||
"""Return the application's base URI (no PATH_INFO or QUERY_STRING)"""
|
||||
url = environ['wsgi.url_scheme']+'://'
|
||||
from urllib import quote
|
||||
from urllib.parse import quote
|
||||
|
||||
if environ.get('HTTP_HOST'):
|
||||
url += environ['HTTP_HOST']
|
||||
|
@ -70,7 +70,7 @@ def application_uri(environ):
|
|||
def request_uri(environ, include_query=1):
|
||||
"""Return the full request URI, optionally including the query string"""
|
||||
url = application_uri(environ)
|
||||
from urllib import quote
|
||||
from urllib.parse import quote
|
||||
path_info = quote(environ.get('PATH_INFO',''))
|
||||
if not environ.get('SCRIPT_NAME'):
|
||||
url += path_info[1:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue