Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
351950fb
Commit
351950fb
authored
Aug 07, 2011
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the old dead test program within the module in 2.7.
parent
e11af59e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
62 deletions
+0
-62
Lib/urllib.py
Lib/urllib.py
+0
-62
No files found.
Lib/urllib.py
View file @
351950fb
...
...
@@ -1600,65 +1600,3 @@ def reporthook(blocknum, blocksize, totalsize):
print "
Block
number
:
%
d
,
Block
size
:
%
d
,
Total
size
:
%
d
" % (
blocknum, blocksize, totalsize)
# Test program
def test(args=[]):
if not args:
args = [
'/etc/passwd',
'file:/etc/passwd',
'file://localhost/etc/passwd',
'ftp://ftp.gnu.org/pub/README',
'http://www.python.org/index.html',
]
if hasattr(URLopener, "
open_https
"):
args.append('https://synergy.as.cmu.edu/~geek/')
try:
for url in args:
print '-'*10, url, '-'*10
fn, h = urlretrieve(url, None, reporthook)
print fn
if h:
print '======'
for k in h.keys(): print k + ':', h[k]
print '======'
with open(fn, 'rb') as fp:
data = fp.read()
if '
\
r
' in data:
table = string.maketrans("", "")
data = data.translate(table, "
\
r")
print data
fn, h = None, None
print '-'*40
finally:
urlcleanup()
def main():
import getopt, sys
try:
opts, args = getopt.getopt(sys.argv[1:], "
th
")
except getopt.error, msg:
print msg
print "
Use
-
h
for
help
"
return
t = 0
for o, a in opts:
if o == '-t':
t = t + 1
if o == '-h':
print "
Usage
:
python
urllib
.
py
[
-
t
]
[
url
...]
"
print "
-
t
runs
self
-
test
;
",
print "
otherwise
,
contents
of
urls
are
printed
"
return
if t:
if t > 1:
test1()
test(args)
else:
if not args:
print "
Use
-
h
for
help
"
for url in args:
print urlopen(url).read(),
# Run test program when run as a script
if __name__ == '__main__':
main()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment