本文整理汇总了Python中xmlrpc.client.ServerProxy.phone方法的典型用法代码示例。如果您正苦于以下问题:Python ServerProxy.phone方法的具体用法?Python ServerProxy.phone怎么用?Python ServerProxy.phone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpc.client.ServerProxy
的用法示例。
在下文中一共展示了ServerProxy.phone方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ServerProxy
# 需要导入模块: from xmlrpc.client import ServerProxy [as 别名]
# 或者: from xmlrpc.client.ServerProxy import phone [as 别名]
#===============================================================================
# challenge page link: http://www.pythonchallenge.com/pc/return/disproportional.html
#===============================================================================
from xmlrpc.client import ServerProxy
from pprint import pprint
server = ServerProxy("http://www.pythonchallenge.com/pc/phonebook.php")
pprint(server.system.listMethods())
print(server.phone("evil"))
print(server.phone("Bert"))
# the output is "555-ITALY"
# reference for xmlrpc (Extensible Markup Language Remote Procedure Call) .client
# https://docs.python.org/3.5/library/xmlrpc.client.html#module-xmlrpc.client
示例2: ServerProxy
# 需要导入模块: from xmlrpc.client import ServerProxy [as 别名]
# 或者: from xmlrpc.client.ServerProxy import phone [as 别名]
#http://www.pythonchallenge.com/pc/return/disproportional.html
from xmlrpc.client import ServerProxy
phonebook = ServerProxy('http://www.pythonchallenge.com/pc/phonebook.php')
print(phonebook.system.listMethods())
#['phone', 'system.listMethods', 'system.methodHelp', 'system.methodSignature', 'system.multicall', 'system.getCapabilities']
print(phonebook.system.methodHelp('phone'))
#Returns the phone of a person
print(phonebook.phone('Bert')) #???
# 555-ITALY
示例3: ServerProxy
# 需要导入模块: from xmlrpc.client import ServerProxy [as 别名]
# 或者: from xmlrpc.client.ServerProxy import phone [as 别名]
#!/usr/bin/python
# encoding:utf-8
# -*- Mode: Python -*-
# Author: Soros Liu <[email protected]>
# ==================================================================================================
# Copyright 2016 by Soros Liu
#
# All Rights Reserved
"""
Refer to blog: http://www.cnblogs.com/dukeleo/p/3471375.html
"""
from xmlrpc.client import ServerProxy
__author__ = 'Soros Liu'
rpc = ServerProxy('http://www.pythonchallenge.com/pc/phonebook.php')
# print(rpc)
methods = rpc.system.listMethods()
print(methods)
for method in methods:
print(method + ' : ' + rpc.system.methodHelp(method))
print(rpc.phone('Bert'))
示例4: ServerProxy
# 需要导入模块: from xmlrpc.client import ServerProxy [as 别名]
# 或者: from xmlrpc.client.ServerProxy import phone [as 别名]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
http://www.pythonchallenge.com/pc/return/disproportional.html
phone that evil
'''
from xmlrpc.client import ServerProxy
server = ServerProxy("http://www.pythonchallenge.com/pc/phonebook.php")
print(server)
#print(server.system.listMethods())
#print(server.system.methodHelp('phone'))
#print(server.phone("evil"))
print(server.phone("Bert"))
示例5: ServerProxy
# 需要导入模块: from xmlrpc.client import ServerProxy [as 别名]
# 或者: from xmlrpc.client.ServerProxy import phone [as 别名]
from xmlrpc.client import ServerProxy
conn = ServerProxy("http://www.pythonchallenge.com/pc/phonebook.php")
print(conn.phone("Leopold"))
示例6: ServerProxy
# 需要导入模块: from xmlrpc.client import ServerProxy [as 别名]
# 或者: from xmlrpc.client.ServerProxy import phone [as 别名]
#! /usr/bin/env python
# gives http://www.pythonchallenge.com/pc/return/italy.html
from xmlrpc.client import ServerProxy, Error
if __name__ == '__main__':
server = ServerProxy('http://www.pythonchallenge.com/pc/phonebook.php')
try:
# resp = server.system.listMethods()
resp = server.phone('Bert')
print(resp)
except Error as err:
print(err)
示例7: print
# 需要导入模块: from xmlrpc.client import ServerProxy [as 别名]
# 或者: from xmlrpc.client.ServerProxy import phone [as 别名]
# request = ur.urlopen(url + number[0])
# # print(request.info())
# print(number[0], reInfo.findall(str(request.info())))
# info.append(reInfo.findall(str(request.info())))
# data = request.read()
# number = reNext.findall(data.decode('utf-8'))
# except:
# break;
# print(info)
# info = ''.join(j for i in info for j in i)
# from tools import writeData
# writeData(info)
import errorWrongCookies, bz2, urllib.request as ur, urllib.parse as up
info = errorWrongCookies.infoRight
info = up.unquote_to_bytes(info)
info = bz2.decompress(info)
print(info)
info = "the flowers are on their way"
from xmlrpc.client import ServerProxy
server = ServerProxy("http://www.pythonchallenge.com/pc/phonebook.php")
#print(server.system.methodHelp('phone'))
print(server.phone("Leopold"))
url = 'http://www.pythonchallenge.com/pc/stuff/violin.php'
request = ur.Request(url, headers={'Cookie': 'info=' + up.quote(info)})
last = ur.urlopen(request).read()
print(last.decode('utf-8'))