当前位置: 首页>>代码示例>>Python>>正文


Python ServerProxy.phone方法代码示例

本文整理汇总了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
开发者ID:Weiming-Hu,项目名称:my-python-challenge-solutions,代码行数:20,代码来源:pc_13.py

示例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
开发者ID:poleha,项目名称:py_examples,代码行数:14,代码来源:13.py

示例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'))
开发者ID:Sorosliu1029,项目名称:PythonChallenge,代码行数:23,代码来源:PythonChallenge13.py

示例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"))
开发者ID:tuouo,项目名称:pythonChallenge,代码行数:16,代码来源:0013phoneTheEvil.py

示例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"))
开发者ID:hackingnote,项目名称:the-python-challenge-solutions,代码行数:7,代码来源:level17_part2.py

示例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)
开发者ID:kyon0304,项目名称:python-challenge,代码行数:15,代码来源:challenge_13.py

示例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'))
开发者ID:tuouo,项目名称:pythonChallenge,代码行数:33,代码来源:0017cookies.py


注:本文中的xmlrpc.client.ServerProxy.phone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。