Created
April 14, 2011 10:08
-
-
Save kgaughan/919221 to your computer and use it in GitHub Desktop.
Checking an EU VAT number using the VIES SOAP interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from suds.client import Client | |
client = Client('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl') | |
# Returns a dict-like object with the fields 'countryCode', 'vatNumber', | |
# 'requestDate', 'valid' (boolean), 'name', and 'address'. | |
result = client.service.checkVat('IE', '6390845P') |
I was having some issues with suds, so in case someone comes across this, here is my alternative:
from zeep import Client
# http://ec.europa.eu/taxation_customs/vies/technicalInformation.html
client = Client('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl')
# Returns a dict-like object with the fields 'countryCode', 'vatNumber',
# 'requestDate', 'valid' (boolean), 'name', and 'address'.
result = client.service.checkVat(country, number)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kgaughan - I've tried using your code exactly as is, but I receive an error. I would say I am new to python, so please if possible - keep it simple. :)
Traceback (most recent call last):
File "C:\Users\nm469mz\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2910, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
from suds.client import Client
File "C:\Users\nm469mz\AppData\Local\Continuum\anaconda3\lib\site-packages\suds\client.py", line 242
except Exception, e:
^
SyntaxError: invalid syntax