Skip to main content

A wrapper API of ANAF web services

Project description

A wrapper API of ANAF web services

Compatibility

=Python 3.4 Tested on python 3.4, 3.5, 3.6, and 3.11

Installation

$ pip install pyAnaf

Usage

From Python:
import datetime
from pyAnaf.api import Anaf

anaf = Anaf()
anaf.setLimit(500) #optional

# adding a list of CUIs and an optional query date
anaf.setCUIList( [36804251, 2785503], date =  datetime.date.today())

# adding a CUI one by one
anaf.addCUI(36804251)
anaf.addCUI(2785503)

# submit the request to ANAF and hope for the best
anaf.Request()

# printing the json returned from ANAF
print (anaf.result)

# or doing more programmatic stuff
first_cui = anaf.getCUIData(36804251)
print (first_cui.cui)
print (first_cui.name)
print (first_cui.address)
print (first_cui.is_active)
print (first_cui.vat_eligible)
print (first_cui.vat_split_eligible)
print (first_cui.vat_collection_eligible)
From the console:
$ pyanaf <list_of_CUIs> <max_limit>

For python3 you might have to set python encoding for your environment (e.g. export PYTHONIOENCODING=utf-8)

E.g.:

$ pyanaf 36804251,2785503 500
$ {   'adresa': '',
'cui': 34434,
'data': '2018-12-12',
'dataActualizareTvaInc': '',
'dataAnulareSplitTVA': '',
'dataInactivare': ' ',
'dataInceputSplitTVA': '',
'dataInceputTvaInc': '',
'dataPublicare': ' ',
'dataPublicareTvaInc': '',
'dataRadiere': ' ',
'dataReactivare': ' ',
'dataSfarsitTvaInc': '',
'data_anul_imp_ScpTVA': '',
'data_inceput_ScpTVA': '',
'data_sfarsit_ScpTVA': '',
'denumire': '',
'mesaj_ScpTVA': '',
'scpTVA': False,
'statusInactivi': False,
'statusSplitTVA': False,
'statusTvaIncasare': False,
'tipActTvaInc': ''}
{   'adresa': '',
'cui': 2,
'data': '2018-12-12',
'dataActualizareTvaInc': '',
'dataAnulareSplitTVA': '',
'dataInactivare': ' ',
'dataInceputSplitTVA': '',
'dataInceputTvaInc': '',
'dataPublicare': ' ',
'dataPublicareTvaInc': '',
'dataRadiere': ' ',
'dataReactivare': ' ',
'dataSfarsitTvaInc': '',
'data_anul_imp_ScpTVA': '',
'data_inceput_ScpTVA': '',
'data_sfarsit_ScpTVA': '',
'denumire': '',
'mesaj_ScpTVA': '',
'scpTVA': False,
'statusInactivi': False,
'statusSplitTVA': False,
'statusTvaIncasare': False,
'tipActTvaInc': ''}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyanaf-0.0.3.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

pyAnaf-0.0.3-py3-none-any.whl (6.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page