-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathdisproportional.py
More file actions
30 lines (22 loc) · 919 Bytes
/
disproportional.py
File metadata and controls
30 lines (22 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
# coding: utf-8
# http://www.pythonchallenge.com/pc/return/disproportional.html
import urllib
# downlaod file with password
# user: huge passwd: file
url="http://huge:file@www.pythonchallenge.com/pc/phonebook.php"
filename=url.split('/')[-1]
urllib.urlretrieve(url,filename)
# from the php file:
# faultCode 105
# faultString XML error: Invalid document end at line 1, column 1
# aparently, this is an xmlrpc error
import xmlrpclib
server=xmlrpclib.ServerProxy("http://www.pythonchallenge.com/pc/phonebook.php")
print server.system.listMethods()
# Got: ['phone', 'system.listMethods', 'system.methodHelp', 'system.methodSignature', 'system.multicall', 'system.getCapabilities']
print server.system.methodHelp('phone')
# Got: Returns the phone of a person
print server.phone('Bert') # 这里的Bert是上一关的提示信息
# Got 555-ITALY
# next level is italy