A wrapper API of VIES VAT web service

Erfan Nariman 359f82defb Merge pull request #9 from agilegeeks/dependabot/pip/lxml-4.9.1 преди 2 години
.github 7ac9dce59f Updaet main.yml преди 3 години
pyVies 3b260fb4ac BUG: swap GR for EL преди 3 години
.gitignore 35896bc350 first commit преди 6 години
AUTHORS 35896bc350 first commit преди 6 години
LICENSE 75d0bdab17 version 0.0.2 преди 6 години
README.md 6cf8276f67 added extended info checking and attributes преди 6 години
requirements.txt 6f4a73586b Bump lxml from 4.6.5 to 4.9.1 преди 2 години
setup.py f108f4b978 Update setup.py преди 3 години

README.md

A wrapper API of VIES VAT web service

Compatibility

Requires Python 2.7 or greater. Has been tested on 2.7, 3.4 and 3.6

Installation

$ pip install pyvieser

Usage

Python API:
from pyVies import api

try:
    vies = api.Vies()
    result = vies.request('RO2785503', 'RO', extended_info=True)

    # 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)
    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'))

From console:
$ 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).