Skip to main content
https://travis-ci.org/iconfinder/pyvat.png?branch=master

With EU VAT handling rules becoming ever more ridiculous and complicated, businesses within the EU are faced with the complexity of having to validate VAT numbers. pyvat was built for Iconfinder’s marketplace to handle just this problem.

Validation of VAT numbers is performed in two steps: firstly, the VAT number is checked against an expression for the given country if one such is available, after which it is checked against a registry if one such is available.

Calculation of VAT rates for sales is supported within the EU for items covered by the new EU directive for VAT on telecommunications, broadcasting and electronic services.

Installation

To install requests, do yourself a favor and don’t use anything other than pip:

$ pip install pyvat

Usage

pyvat exposes its functionality through three simple methods:

pyvat.check_vat_number(vat_number, country_code=None)

Test if a VAT number is valid.

If possible, the VAT number will be checked against available registries.

Parameters:
  • vat_number – VAT number to validate.

  • country_code – Optional country code. Should be supplied if known, as there is no guarantee that naively entered VAT numbers contain the correct alpha-2 country code prefix for EU countries just as not all non-EU countries have a reliable country code prefix. Default None prompting detection.

Returns:

True if the VAT number can be fully asserted as valid or False if not, otherwise None indicating that the VAT number may or may not be valid.

pyvat.is_vat_number_format_valid(vat_number, country_code=None)

Test if the format of a VAT number is valid.

Parameters:
  • vat_number – VAT number to validate.

  • country_code – Optional country code. Should be supplied if known, as there is no guarantee that naively entered VAT numbers contain the correct alpha-2 country code prefix for EU countries just as not all non-EU countries have a reliable country code prefix. Default None prompting detection.

Returns:

True if the VAT number can be fully asserted as valid or False if not, otherwise None indicating that the VAT number may or may not be valid.

pyvat.get_sale_vat_charge(date, item_type, buyer, seller)

Get the VAT charge for performing the sale of an item.

Currently only supports determination of the VAT charge for telecommunications, broadcasting and electronic services in the EU.

Parameters:
  • date (datetime.date) – Sale date.

  • item_type (pyvat.ItemType) – Type of the item being sold.

  • buyer (pyvat.Party) – Buyer.

  • seller (pyvat.Party) – Seller.

Returns:

The VAT charge to be applied to the sale of an item.

For more detailed documentation, see the full pyvat documentation.

Metadata

Release files for pyvat 1.3.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyvat 1.3.14
File Size Uploaded
pyvat-1.3.14.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyvat 1.3.14
File Interpreter ABI Platform
pyvat-1.3.14-py3-none-any.whl Python 3 none any Details

Total release size: 26.3 kB

Release files / pyvat-1.3.14.tar.gz

Download URL pyvat-1.3.14.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8e55b1bc198076f549e1450d75bac2b737e7d2e1091e05930433af296794e5af
BLAKE2b-256 checksum
How to use checksums
2a3bd6e84e2604e6c0fcf7c97dba5c7fe7a7e7a5a20ac50ade7f97f487f5ccb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / pyvat-1.3.14-py3-none-any.whl

Download URL pyvat-1.3.14-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0720cfe91b96f4c3eb8d72020773256f6718ec0e73fcceaf1df1ac735dafd0e
BLAKE2b-256 checksum
How to use checksums
28336c46412543bef2b398783c11adfbfae23fd750edde63d8703a7c1ff94b62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

1.3.18

1 release file

1.3.16

2 release files

This release

1.3.14 This release

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page