使用postnl locations soap api的python包装器
postnl-locations的Python项目详细描述
使用postnl locations soap api的python包装器。你可以找到源代码 这里:python-postnl-locations。
兼容性
这个包依赖于suds-jurko,一个完全兼容的原始版本 包中包含一些错误修复和速度改进,并支持python3。 所以这个包依赖于它(suds-py3仍然有一些兼容性问题)。
用法
要使用此软件包,请执行以下步骤:
- 以某种方式安装这个python包。(pip install postnl-locations)
- 在项目中,创建至少包含以下参数的设置字典:
MY_SETTINGS={# this is the testservice wsdl, see the PostNL documentation for the production settings'wsdl':"https://testservice.postnl.com/CIF_SB/LocationWebService/2_0/?wsdl",'countrycode':'NL','username':"my-username",# the password is SHA1 hashed'password':"my-sha1-hashed-password",}
- 按如下方式使用客户端:
frompostnl.locations.clientimportLocationslocations=Locations(settings=MY_SETTINGS)my_locations=locations.nearest_locations(postalcode="6821AD")
查看settings.py以获取更多选项(例如,您可以使用自定义resultsTransform类调整结果)。