Python的XMLSchema绑定包 PyXB

码农软件 · 软件分类 · XML相关工具 · 2019-09-18 22:29:27

软件介绍

PyXB (“pixbee”) 是一个纯 Python 的类库用来根据 XML Schema 生成对应的 Python 类,开发人员可以使用这些类来操作XML Schema 数据。

示例代码:

import weather
import time
import pyxb.utils.domutils as domutils
import sys
import pyxb.standard.bindings.soapenv as soapenv
import pyxb.standard.bindings.soapenc as soapenc
import urllib2

zip = 85711
if 1 < len(sys.argv):
zip = int(sys.argv[1])

# Create an envelope, and give it a body that is the request for the
# service we want.
env = soapenv.Envelope()
env.setBody(weather.GetCityForecastByZIP(ZIP=zip))

# Invoke the service
uri = urllib2.Request('http://ws.cdyne.com/WeatherWS/Weather.asmx',
env.toxml(),
{ 'SOAPAction' : "http://ws.cdyne.com/WeatherWS/GetCityForecastByZIP", 'Content-Type': 'text/xml' } )
rxml = urllib2.urlopen(uri).read()

# Convert the response to a SOAP envelope, then extract the actual
# response from the wildcard elements of the body. Note that because
# the weather namespace was registered, PyXB already created the
# binding for the response.
soap_resp = soapenv.CreateFromDOM(domutils.StringToDOM(rxml))
resp = soap_resp.Body().wildcardElements()[0]

fc_return = resp.GetCityForecastByZIPResult()
if fc_return.Success():
print 'Got response for %s, %s:' % (fc_return.City(), fc_return.State())
for fc in fc_return.ForecastResult().Forecast():
when = time.strftime('%A, %B %d %Y', fc.Date().timetuple())
outlook = fc.Desciption() # typos in WSDL left unchanged
low = fc.Temperatures().MorningLow()
high = fc.Temperatures().DaytimeHigh()
print ' %s: %s, from %s to %s' % (when, outlook, low, high)

本文地址:https://codercto.com/soft/d/14902.html

图解密码技术(第3版)

图解密码技术(第3版)

[日] 结城浩 / 周自恒 / 人民邮电出版社 / 2016-6 / 89.00元

本书以图配文的形式,详细讲解了6种最重要的密码技术:对称密码、公钥密码、单向散列函数、消息认证码、数字签名和伪随机数生成器。 第1部分讲述了密码技术的历史沿革、对称密码、分组密码模式(包括ECB、CBC、CFB、OFB、CTR)、公钥、混合密码系统。第2部分重点介绍了认证方面的内容,涉及单向散列函数、消息认证码、数字签名、证书等。第3部分讲述了密钥、随机数、PGP、SSL/TLS 以及密码技......一起来看看 《图解密码技术(第3版)》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具