apapi

APAPI

APAPI is an unofficial library that allows you to connect to Anaplan APIs using Python. Currently, you can authenticate using either Basic Authentication (email & password), or OAuth2 (client_id & refresh_token, both non-rotatable and rotatable) - Cert based authentication is on the roadmap. Use Bulk, Transactional, ALM and Audit endpoints, with more coming soon!

As an abstract example, here we export some CSV and import it back to Anaplan:

>> > import apapi
>> > with apapi.BasicAuth(f"{email}:{password}") as authentication:
    >> > my_connection = apapi.BulkConnection(authentication)
>> > my_connection.run_export(model_id, export_id)
>> > data = my_connection.get_file(model_id, export_id)
>> > print(data.decode())
Versions, Data, Text
Actual, 1, test
Budget, 2.5, ąćęłńśżź
Forecast, -3,😂
>> > my_connection.put_file(model_id, file_id, data)
>> > my_connection.run_import(model_id, import_id)

Full documentation can be found here. Check examples or tests for more examples and hints about usage.

Installing Anaplan Python API and Supported Versions

APAPI is available on PyPI:

$ python -m pip install apapi

APAPI supports Python 3.8+.

More Info

How to Contribute

Contributions are welcome, even if you can't code it - in such case, please submit an issue if you need any additional feature (preferably in the form of User Story, like "As {who} I need {what} because {why}"). If you encounter any bugs, please report the problem with a description and error log.

PyPI - Python Version PyPI - License Code style: black Imports: isort

 1"""
 2.. include:: ../README.md
 3"""
 4import logging
 5
 6from . import utils
 7from .__version__ import (
 8    __author__,
 9    __author_email__,
10    __copyright__,
11    __description__,
12    __license__,
13    __title__,
14    __url__,
15    __version__,
16)
17from .alm import ALMConnection
18from .audit import AuditConnection
19from .authentication import BasicAuth, OAuth2NonRotatable, OAuth2Rotatable
20from .basic_connection import BasicConnection
21from .bulk import BulkConnection
22from .connection import Connection
23from .transactional import TransactionalConnection
24
25# Set default logging handler to avoid "No handler found" warnings.
26logging.getLogger(__name__).addHandler(logging.NullHandler())