vies增值税web服务的包装api
pyvieser的Python项目详细描述
vies增值税web服务的包装api
兼容性
需要Python2.7或更高版本。 已在2.7、3.4和3.6上进行了测试
安装
$ pip install pyvieser
用法
python api:
frompyViesimportapitry:vies=api.Vies()result=vies.request('RO2785503','RO',extended_info=True)# works as well# result = vies.request('RO2785503')# result = vies.request('RO2785503', 'RO')exceptapi.ViesValidationErrorase:print(e)exceptapi.ViesHTTPErrorase:print(e)exceptapi.ViesErrorase:print(e)else:print(result)print(result.vatNumber)print(result.valid)# You may also use clean to extract vat number and country code# The line bellow would print ('2785503', 'RO')print(vies.clean('RO2785503'))
来自控制台:
$ pyvies <vat_number>
号码应该以国家代码开头。 对于python3,您可能需要为您的环境设置python编码(例如export pythonionecoding=utf-8)。