本文整理汇总了Python中xmlrpclib.ServerProxy.phone方法的典型用法代码示例。如果您正苦于以下问题:Python ServerProxy.phone方法的具体用法?Python ServerProxy.phone怎么用?Python ServerProxy.phone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpclib.ServerProxy
的用法示例。
在下文中一共展示了ServerProxy.phone方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
# http://www.pythonchallenge.com/pc/return/disproportional.html
# ahh the old RPC one...
# http://www.pythonchallenge.com/pc/phonebook.php returns XML
# we want to phone bert
from xmlrpclib import ServerProxy, Error
server = ServerProxy("http://www.pythonchallenge.com/pc/phonebook.php")
print server.system.listMethods()
# ['phone', 'system.listMethods', 'system.methodHelp', 'system.methodSignature', 'system.multicall', 'system.getCapabilities']
print server.phone('Bert')
# 555-ITALY
示例2: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
import xmlrpclib
from xmlrpclib import ServerProxy
server = ServerProxy("http://www.pythonchallenge.com/pc/phonebook.php")
print server.system.listMethods()
print server.phone("Leopold")
print server.phone("leopold")
print server.phone("sorry")
print server.phone("please")
print server.phone("please!")
示例3: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
import xmlrpclib
from xmlrpclib import ServerProxy
server = ServerProxy("http://www.pythonchallenge.com/pc/phonebook.php")
print server.system.listMethods()
##we zien nu dat er een "phone" method is.
print server.phone("bert")
print server.phone("Bert")
print server.phone("BERT")
##enkel "Bert" werkt.
示例4: xrange
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
else:
guess = sys.argv[1]
result = ''
for i in xrange(400):
r = requests.get('http://www.pythonchallenge.com/pc/def/linkedlist.php?busynothing=%s' % guess)
result += r.cookies['info']
guess = pat.search(r.text).group(0)
if not guess:
print r.text
break
# result looks like:
# BZh91AY%26SY%94%3A%E2I%00%00%21%19%80P%81%11%00%AFg%9E%A0+%00hE%3DM%B5%23%D0%D4%D1%E2%8D%06%A9%FA%26S%D4%D3%21%A1%EAi7h%9B%9A%2B%BF%60%22%C5WX%E1%ADL%80%E8V%3C%C6%A8%DBH%2632%18%A8x%01%08%21%8DS%0B%C8%AF%96KO%CA2%B0%F1%BD%1Du%A0%86%05%92s%B0%92%C4Bc%F1w%24S%85%09%09C%AE%24%90
# have to unquote
print bz2.decompress(urllib.unquote_plus(result))
# is it the 26th already? call his father and inform him that "the flowers are on their way". he'll understand.
# Mozart's father = Leopold -> look up his phone number
from xmlrpclib import ServerProxy
server = ServerProxy('http://www.pythonchallenge.com/pc/phonebook.php')
print server.phone('Leopold')
# 555-VIOLIN
cookies = dict(info='the flowers are on their way')
r = requests.get('http://www.pythonchallenge.com/pc/stuff/violin.php', cookies=cookies)
print r.content
# oh well, don't you dare to forget the balloons
print 'http://huge:[email protected]/pc/return/balloons.html'
示例5: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
try:
number = re.findall('[0-9]+',text)[-1]
except:
print s
# BZh91AY%26SY%94%3A%E2I%00%00%21%19%80P%81%11%00%AFg%9E%A0+%00hE%3DM%B5%23%D0%D4%D1%E2%8D%06%A9%FA%26S%D4%D3%21%A1%EAi7h%9B%9A%2B%BF%60%22%C5WX%E1%ADL%80%E8V%3C%C6%A8%DBH%2632%18%A8x%01%08%21%8DS%0B%C8%AF%96KO%CA2%B0%F1%BD%1Du%A0%86%05%92s%B0%92%C4Bc%F1w%24S%85%09%09C%AE%24%90
break
#Replace %xx escapes in s by their single-character equivalent, also replace plus signs by spaces
s = urllib.unquote_plus(s)
#Decompress data in one shot
s = bz2.decompress(s)
print s
#is it the 26th already? call his father and inform him that "the flowers are on their way". he'll understand.
proxy = ServerProxy('http://www.pythonchallenge.com/pc/phonebook.php')
print proxy.phone('Leopold')
#555-VIOLIN
#violin
#http://www.pythonchallenge.com/pc/return/violin.html
#no! i mean yes! but ../stuff/violin.php.
#http://www.pythonchallenge.com/pc/stuff/violin.php
url = 'http://www.pythonchallenge.com/pc/stuff/violin.php'
msg = "the flowers are on their way"
list(cj)[0].value = msg
opener.addheaders.append(('Cookie', 'value=%s' % msg))
print opener.open(url).read()
#oh well, don't you dare to forget the balloons
示例6: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
#http://www.pythonchallenge.com/pc/return/disproportional.html
from xmlrpclib import ServerProxy
server = ServerProxy('http://www.pythonchallenge.com/pc/phonebook.php')
#print(server.system.listMethods())
#http://www.pythonchallenge.com/pc/return/evil4.jpg said Bert is evil!
print(server.phone('Bert'))
示例7: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
from xmlrpclib import ServerProxy
url = 'http://www.pythonchallenge.com/pc/phonebook.php'
sp = ServerProxy(url)
# print 'ServerProxy: ', sp
# print 'Server methods: ', sp.system.listMethods()
# print '"Phone" method: ', sp.system.methodSignature('phone')
# print sp.system.methodHelp('phone')
print sp.phone('Bert')
示例8: is
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
# get next number
page = u.read()
match = re.search('and the next busynothing is (\d+)',page)
if match:
next_nothing = match.group(1)
numbers.append(next_nothing)
else:
solution = page
numbers = [ int(n) for n in numbers ]
cookie_string = ''.join(cookie_collection)
print 'Sequence Length: ',len(numbers)
print 'Final item: '+page
unquoted = urllib.unquote_plus(cookie_string)
print bz2.decompress(unquoted)
url = 'http://www.pythonchallenge.com/pc/phonebook.php'
sp = ServerProxy(url)
print sp.phone('Leopold')
message = 'the flowers are on their way'
url = "http://www.pythonchallenge.com/pc/stuff/violin.php"
# totally copied this from somewhere
req = urllib2.Request(url,headers={'Cookie': 'info=' + urllib.quote_plus(message)})
print urllib2.urlopen(req).read()
示例9: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
from xmlrpclib import ServerProxy
# https://docs.python.org/2/library/xmlrpclib.html
proxy = ServerProxy('http://www.pythonchallenge.com/pc/phonebook.php')
## list methods
#>>> proxy.system.listMethods()
# ['phone', 'system.listMethods', 'system.methodHelp', 'system.methodSignature', 'system.multicall', 'system.getCapabilities']
## get phone signature
#>>> proxy.system.methodSignature('phone')
#[['string', 'string']]
# test phone method
#>>> proxy.phone('teste')
#'He is not the evil'
print proxy.phone('Bert')
示例10: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
'''
http://www.pythonchallenge.com/pc/return/disproportional.html
'''
# Since May 30 2012
# From http://holger.thoelking.name/python-challenge/13
from xmlrpclib import ServerProxy
conn = ServerProxy("http://www.pythonchallenge.com/pc/phonebook.php")
print conn.phone("Bert")
示例11: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
# http://www.pythonchallenge.com/pc/return/disproportional.html
import xmlrpclib
from xmlrpclib import ServerProxy
# Clicking on the 5 button on the image on the website brings up an XML
# file which is obviously an XML-RPC fault, see
# http://en.wikipedia.org/wiki/XML_RPC#Examples
# This leads us to believe that this level's URL is an XML-RPC service
# endpoint.
url = 'http://www.pythonchallenge.com/pc/phonebook.php'
serverProxy = ServerProxy(url)
methods = serverProxy.system.listMethods()
print 'Methods on server:'
print methods, '\n'
phoneNumber = serverProxy.phone('Bert')
print phoneNumber, '\n'
urlComponent = 'italy'
print 'urlComponent:'
print urlComponent
示例12: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import phone [as 别名]
#!/usr/vin/env python
"""
http://huge:[email protected]/pc/return/disproportional.html
"""
from xmlrpclib import ServerProxy, Error
server = ServerProxy("http://www.pythonchallenge.com/pc/phonebook.php")
# print server.system.listMethods()
print server.phone("Bert")