本文整理汇总了Python中SOAPpy.SOAPProxy类的典型用法代码示例。如果您正苦于以下问题:Python SOAPProxy类的具体用法?Python SOAPProxy怎么用?Python SOAPProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SOAPProxy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getWaterLevelSoappyNow
def getWaterLevelSoappyNow(stationId,debug=False):
'''
Use OLD SOAPpy interface to get the waterlevel for a station
'''
d = datetime.datetime.utcnow()
print 'FIX: do this in seconds space!!!! This is crap!'
startD = d + datetime.timedelta(minutes=-20)
endD = d + datetime.timedelta(minutes=10)
#startMin = int(d.minute) - 6
#endMin = int(d.minute) + 1
print startD,endD,d
beginDate = str(startD.year)+('%02d' % startD.month)+('%02d' % startD.day)+' '+ ('%02d' % (startD.hour))+':'+('%02d' % (startD.minute))
endDate = str(endD.year)+('%02d' % endD.month)+('%02d' % endD.day)+' '+ ('%02d' % (endD.hour))+':'+('%02d' % (endD.minute))
#print beginDate,endDate
from SOAPpy import SOAPProxy
url = 'http://opendap.co-ops.nos.noaa.gov/axis/services/WaterLevelRawSixMin'
namespace='urn:WaterLevelRawSixMin' # This really can be anything. It is ignored
server = SOAPProxy(url,namespace)
if debug: server.config.debug=1
#response = server.getWaterLevelRawSixMin(stationId=str(stationId),beginDate='20051201 00:00',endDate='20051201 00:18',datum='MLLW',unit=0,timeZone=0)
response = server.getWaterLevelRawSixMin(stationId=str(stationId),beginDate=beginDate,endDate=endDate,datum='MLLW',unit=0,timeZone=0)
# only return the last entry
return response.item[-1]
示例2: getGrados
def getGrados(request):
if request.method == "GET":
codigo = request.GET.get('cod')
curso = request.GET.get('curso')
server = SOAPProxy('www.abj-ws-devborja.c9users.io:8080')
res = server.obtenerGruposAsignaturaInformatica(codigo, curso)
return HttpResponse(res)
示例3: test_fc
def test_fc(fc_name):
if os.environ.has_key("http_proxy"):
my_http_proxy=os.environ["http_proxy"].replace("http://","")
else:
my_http_proxy=None
doc = minidom.parse(xml_file)
ns = 'urn:fc.ildg.lqcd.org'
for fc_test in doc.documentElement.getElementsByTagName("fc"):
grid_name=fc_test.getElementsByTagName("name")[0].childNodes[0].nodeValue
fc_url=fc_test.getElementsByTagName("url")[0].childNodes[0].nodeValue
if grid_name == fc_name:
try:
server = SOAPProxy(fc_url, namespace=ns, http_proxy=my_http_proxy)
for test_unit in fc_test.getElementsByTagName("test-unit"):
lfn=test_unit.getElementsByTagName("lfn")[0].childNodes[0].nodeValue
response=server.getURL(lfnList=lfn)
val_test=True
for val in test_unit.getElementsByTagName("surl"):
val_test=val_test and val.childNodes[0].nodeValue in response.resultList[0].surlList
print '==',val.childNodes[0].nodeValue
print val.childNodes[0].nodeValue in response.resultList[0].surlList
print test_unit.getElementsByTagName("surl").length
# print response
# print response.resultList
# print response.resultList[0].surlList
# print len(response.resultList[0].surlList)
# for item in response.resultList[0].surlList:
# print '--',item
# print val_test
if val_test==True: return 0
return 1
except Exception,inst:
print inst
return -1
示例4: __init__
def __init__(self, url, user = None, passwd = None):
if user == None:
self.server = SOAPProxy(url)
else:
self.server = SOAPProxy(url, transport = HTTPHeaderTransport)
self.server.transport.headers = {'Username' : user,
'Password' : passwd}
示例5: googleSearch
def googleSearch(title):
'''
It is the function of the application that make the request at google WS using
getting the first url of response.
@param title: the title of the article to serach for
@return: the first url
'''
_query=title
# create SOAP proxy object
google = SOAPProxy(_url, _namespace)
# call search method over SOAP proxy
results = google.doGoogleSearch( _license_key, _query,
_start, _maxResults,
_filter, _restrict,
_safeSearch, _lang_restrict, '', '' )
# display results
# print 'google search for " ' + _query + ' "\n'
# print 'estimated result count: ' + str(results.estimatedTotalResultsCount)
# print ' search time: ' + str(results.searchTime) + '\n'
# print 'results ' + str(_start + 1) + ' - ' + str(_start + _maxResults) +':\n'
numresults = len(results.resultElements)
if numresults:
url = results.resultElements[0].URL
else:
url= "#"
return url
示例6: createSNOWIncident
def createSNOWIncident(self, params_dict):
import datetime
from SOAPpy import SOAPProxy
# instance to send to
instance = 'Company1prod'
# username/password
username = 'svcArcSight'
password = '[email protected]'
# proxy - NOTE: ALWAYS use https://INSTANCE.service-now.com, not https://www.service-now.com/INSTANCE for web services URL from now on!
proxy = 'https://%s:%[email protected]%s.service-now.com/incident.do?SOAP' % (username, password, instance)
namespace = 'http://www.service-now.com/'
server = SOAPProxy(proxy, namespace)
# uncomment these for LOTS of debugging output
# server.config.dumpHeadersIn = 1
# server.config.dumpHeadersOut = 1
# server.config.dumpSOAPOut = 1
# server.config.dumpSOAPIn = 1
response = server.insert(impact=int(params_dict['impact']), urgency=int(params_dict['urgency']), priority=int(params_dict['priority']), category=params_dict['category'], u_current_location=params_dict['location'], caller_id=params_dict['user'], assignment_group=params_dict['assignment_group'], subcategory=params_dict['subcategory'], short_description=params_dict['short_description'], description=params_dict['description'], u_business_unit=params_dict['business_unit'])
return response
示例7: switchIrcut
def switchIrcut(n):
try:
client = SOAPProxy(url, namespace=namespace)
report = client.switchIRFilter("all", n)
msg = "Subject: [FAMNET] IR CUT FILTER report\n\nreport:\n%s" % report
except Error, s:
msg="Subject: [FAMNET] connection to streamer failed\n%s" % s
示例8: createincident
def createincident(params_dict):
# instance to send to
instance='xxxxxx'
# username/password
username='xxxxx'
password='xxxxxx'
# proxy - NOTE: ALWAYS use https://INSTANCE.service-now.com, not https://www.service-now.com/INSTANCE for web services URL from now on!
# proxy = 'https://%s:%[email protected]%s.service-now.com/u_nimsoft.do?WSDL' % (username, password, instance)
proxy = 'https://%s:%[email protected]%s.service-now.com/incident.do?SOAP' % (username, password, instance)
namespace = 'http://www.service-now.com/'
server = SOAPProxy(proxy, namespace)
# uncomment these for LOTS of debugging output
#server.config.dumpHeadersIn = 1
#server.config.dumpHeadersOut = 1
#server.config.dumpSOAPOut = 1
#server.config.dumpSOAPIn = 1
response = server.insert(
impact=int(params_dict['impact']),
urgency=int(params_dict['urgency']),
# caller_id=params_dict['caller_id'],
category=str(params_dict['category']),
assignment_group=params_dict['assignment_group'],
short_description=params_dict['short_description'],
comments=params_dict['comments'])
return response
示例9: getActiveStationsSoappy
def getActiveStationsSoappy(debug=False):
'''
Use the old SOAPpy interface to get the stations
Here is the results for one station:
print response.station[1]
<SOAPpy.Types.structType station at 20681072>: {'parameter': ['', ''], 'metadata': <SOAPpy.Types.structType metadata at 20683272>: {'date_established': '1954-11-24', 'location': <SOAPpy.Types.structType location at 20635240>: {'lat': '21 57.3 N', 'state': 'HI', 'long': '159 21.4 W'}}}
>>> response = getActiveStationsSoappy()
>>> str(response.station[1].metadata.location.lat)
'21 57.3 N'
>>> str(response.station[1].metadata.location.long)
'159 21.4 W'
>>> str(response.station[1].metadata.location.state)
'HI'
@param debug: set to true to see more information about the transaction
@return: a large typestring
'''
from SOAPpy import SOAPProxy
url = 'http://opendap.co-ops.nos.noaa.gov/axis/services/ActiveStations'
namespace='urn:ActiveStations' # This really can be anything. It is ignored
server = SOAPProxy(url,namespace)
if debug: server.config.debug=1
response = server.getActiveStations()
return response
示例10: getAsignaturas
def getAsignaturas(request):
server = SOAPProxy('www.abj-ws-devborja.c9users.io:8080')
res = json.loads(server.obtenerAsignaturasGradoInformatica())
data = {}
data["1"] = []
data["2"] = []
data["3"] = []
data["4"] = []
data["X"] = []
for asig in res["asignaturas"]:
obj = {}
obj["nombreAsignatura"] = asig["nombreAsignatura"]
obj["codigo"] = asig["codigo"]
if asig["curso"] == "1":
data["1"].append(obj)
elif asig["curso"] == "2":
data["2"].append(obj)
elif asig["curso"] == "3":
data["3"].append(obj)
elif asig["curso"] == "4":
data["4"].append(obj)
else:
data["X"].append(obj)
return HttpResponse(json.dumps(data))
示例11: test_cnr_api
def test_cnr_api():
namespace = ("m", "urn:mpc")
url = "http://10.20.30.21:8088/"
proxy = SOAPProxy(url,namespace)
proxy.config.debug = 1
proxy.mpccommit(
strInput = "foo"
)
示例12: getSemilla
def getSemilla():
from SOAPpy import SOAPProxy
import lxml.etree as ET
url = 'https://maullin.sii.cl/DTEWS/CrSeed.jws?WSDL'
ns = 'urn:https://maullin.sii.cl/DTEWS/CrSeed.jws'
_server = SOAPProxy(url, ns)
root = ET.fromstring(_server.getSeed())
semilla = root[0][0].text
return semilla
示例13: getToken
def getToken(archivo_de_la_semilla):
from SOAPpy import SOAPProxy
import lxml.etree as ET
url = 'https://maullin.sii.cl/DTEWS/GetTokenFromSeed.jws?WSDL'
ns = 'urn:https://maullin.sii.cl/DTEWS/GetTokenFromSeed.jws'
_server = SOAPProxy(url, ns)
tree = ET.parse(archivo_de_la_semilla)
ss = ET.tostring(tree, pretty_print=True, encoding='iso-8859-1')
respuesta = ET.fromstring(_server.getToken(ss))
token = respuesta[0][0].text
return token
示例14: calendarioanual
def calendarioanual(request):
if request.method == 'GET':
return render(request, 'calendarioanual.html', {})
elif request.method == "POST":
body_unicode = request.body.decode('utf-8')
received_json_data = json.loads(body_unicode)
json.dumps(received_json_data)
server = SOAPProxy('www.abj-ws-devborja.c9users.io:8082')
res = server.crearCalendario(received_json_data)
calendario = {}
calendario["calendario"] = res
return HttpResponse(json.dumps(calendario))
示例15: generate_keywords
def generate_keywords(text):
server = SOAPProxy('http://metanet4u.research.um.edu.mt/services/MtPOS?wsdl')
# '_NN' is 3 characters long
words = [w[:-3] for w in server.tagParagraphReturn(text).split(' ') if w[-2:] == 'NN']
word_dict = defaultdict(int)
for word in words:
word_dict[word] += 1
# returning the most common keywords
return [x[0] for x in (sorted(word_dict.iteritems(), key=itemgetter(1), reverse=True)[:5])]