A wrapper API of VIES VAT web service
|
6 年之前 | |
---|---|---|
pyVies | 6 年之前 | |
.gitignore | 6 年之前 | |
AUTHORS | 6 年之前 | |
LICENSE | 6 年之前 | |
README.md | 6 年之前 | |
setup.py | 6 年之前 |
Requires Python 2.7 or greater. Has been tested on 2.7, 3.4 and 3.6
$ pip install pyVies
from pyVies import api
try:
vies = api.Vies()
result = vies.request('2785503', 'RO')
# works as well
# result = vies.request('RO2785503')
# result = vies.request('RO2785503', 'RO')
except api.ViesValidationError as e:
print (e)
except api.ViesHTTPError as e:
print (e)
except api.ViesError as e:
print (e)
else:
print (result)
"""
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>
The number should start with the country code. For python3 you might have to set python encoding for your environment (e.g. export PYTHONIOENCODING=utf-8).