Package: prometeo
Prometeo Python API ClientThis is the official python library for thePrometeo APIDocumentationComplete client documentation is available atRead the docsInstallationPrerequisitesPython version 2.7 and 3.5+An API Key (contact usto get one!)Install package$pipinstallprometeoQuick StartGet your keyGo toyour dashboard, there you'll find your API key. Use it to instantiate the client:fromprometeoimportClientclient=Client('<YOUR_API_KEY>',environment='testing')Theenvironmentargument is eithertestingfor the sandbox orproductionfor the production environment.Listing movementsThe following example logs in to the sandboxed bank and retrieves a list of movementsfromdatetimeimportdatetimesession=client.banking.login(provider='test',username='12345',password='gfdsa')accounts=session.get_accounts()account=accounts[0]print(account.number,' - ',account.name)movements=account.get_movements(datetime(2019,2,1),datetime(2019,2,2))formovementinmovements:print(movement.detail,movement.debit,movement.credit)Listing credit card movementscards=session.get_credit_cards()card=cards[0]print(card.number,' - ',card.name)movements=card.get_movements('USD',datetime(2019,2,1),datetime(2019,2,2))formovementinmovements:print(movement.detail,movement.debit,movement.credit)Listing all available banksproviders=client.banking.get_providers()forproviderinproviders:print(provider.name,provider.country)CURP APIChecking the existence of a curpfromprometeo.curpimportexceptionscurp='ABCD12345EFGH'try:result=client.curp.query(curp)exceptexceptions.CurpErrorase:print("CURP does not exist:",e.message)Looking for a CURP by personfromdatetimeimportdatetimefromprometeo.curpimportexceptions,Gender,Statecurp='ABCD12345EFGH'state=State.SINALOAbirthdate=datetime(1988,3,4)name='JOHN'first_surname='DOE'last_surname='PONCE'gender=Gender.MALEtry:result=client.curp.reverse_query(state,birthdate,name,first_surname,last_surname,gender)exceptexceptions.CurpErrorase:print("CURP does not exist:",e.message)DIAN APILog inSupply the NIT to log in as a company:fromprometeo.dianimportDocumentTypesession=client.dian.login(nit='098765',document_type=DocumentType.CEDULA_CIUDADANIA,document='12345',password='test_password',)Or omit it to log in as a person:fromprometeo.dianimportDocumentTypesession=client.dian.login(document_type=DocumentType.CEDULA_CIUDADANIA,document='12345',password='test_password',)Get the dataCompany info:session.get_company_info()Balances:session.get_balances()Rent declaration:session.get_rent_declaration(2018)VAT declaration:fromprometeo.dianimportPeriodicity,QuartlerlyPeriodsession.get_vat_declaration(2019,Periodicity.QUARTERLY,QuartlerlyPeriod.JANUARY_APRIL)Numeration:fromdatetimeimportdatetimefromprometeo.dianimportNumerationTypesession.get_numeration(NumerationType.Authorization,datetime(2019,1,1),datetime(2019,5,1))Retentions:fromprometeo.dianimportMonthlyPeriodsession.get_retentions(2019,MonthlyPeriod.NOVEMBER)SAT APILogin infromprometeo.satimportLoginScopesession=client.sat.login(rfc='ABCD1234EFGH',password='password',scope=LoginScope.CFDI,)Work with CFDI billsList emitted and received billsfromprometeo.satimportBillStatusemitted_bills=session.get_emitted_bills(date_start=datetime(2020,1,1),date_end=datetime(2020,2,1),status=BillStatus.ANY,)received_bills=session.get_received_bills(year=2020,month=1,status=BillStatus.ANY,Bulk download of billsfromprometeo.satimportBillStatusdownload_requests=session.download_emitted_bills(date_start=datetime(2020,1,1),date_end=datetime(2020,2,1),status=BillStatus.ANY,)forrequestindownload_requests:download=request.get_download()content=download.get_file().read()Download acknowledgementsfromprometeo.satimportMotive,DocumentType,Status,SendTypeacks=session.get_acknowledgement(year=2020,month_start=1,month_end=2,motive=Motive.ALL,document_type=DocumentType.ALL,status=Status.ALL,send_type=SendType.ALL,)forackinacks:download=ack.download().get_file()How to run testsWe are using thetoxtesting librarytoxTo run the tests imlpemented inside thetestsfolder simply run the following command inside your project:toxThis will run tests for both python 2 and 3. To restrict the result to only python3 use:tox -e py3How to generate HTML documentationInside your terminal, move to the/docsfolder (there should be a file namedMakefile), run the following command:make htmlThis will generate the HTML files inside thedocs/_buildfolder.NotesDo not installpip install prometeopackage inside the same virtual enviroment where this project is running as it may cause conflicts while running unittest.To use the local files insted of the production source code, install it withpip install prometeo --no-index --find-links file:///srv/pkg/mypackageLicenseThe MIT License