A simple Python client to use the Akeneo PIM API.
Dependencies are managed with poetry (list of dependencies available in pyproject.toml).
You may install them with:
poetry install --dev
poetry install pyakeneo
Initialization of the client
from pyakeneo.client import Client
c = Client(
AKENEO_URL,
username=AKENEO_USER,
password=AKENEO_PASSWORD,
client_id=AKENEO_CLIENT_ID,
secret=AKENEO_SECRET,
)
Then, you have a pool for every data type in Akeneo PIM.
# products
c.products.fetch_item('ITEM_SKU')
c.products.fetch_list({'limit': 100, 'page': 1, 'pagination_type': 'page'})
# assets
c.asset_families.assets('asset_family_code').fetch_item('ASSET_CODE')
c.asset_families.assets('asset_family_code').fetch_list({'search': {"code":[{"operator":"IN","value":["CODE_1", "CODE_2"]}]}})
Run tests as follow:
poetry run nosetests
If tests don't pass in your environment, please check that dependencies match those described in pyproject.toml. One way to do it is to ensure that poetry runs commands in a dedicated virtualenv by setting environment variable as follow:
poetry install --dev
Tests are provided with mocks, recorded with VCR.py. In case you need to (re)run tests, you should install the dataset in you PIM instance as follow: