Skip to main content

Akeneo Connector and Paginator

This repository contains two Python classes designed to facilitate interacting with Akeneo's REST API: AkeneoConnector for making HTTP requests to Akeneo endpoints, and AkeneoPaginator for handling paginated responses from Akeneo.

AkeneoConnector

The AkeneoConnector class simplifies authentication and requests to the Akeneo API. It supports GET, PATCH, and POST requests, handling token-based authentication and request headers internally.

Features

  • Supports token-based authentication with Akeneo.
  • Simplifies GET, PATCH, and POST requests to Akeneo.
  • Automatically handles request headers.

Usage

To use 'AkeneoConnector', you need to provide your Akeneo credentials and the base URL for your Akeneo API:

from akeneo_connector import AkeneoConnector

# Initialize the connector
connector = AkeneoConnector(username='your_username', password='your_password', auth_token='your_auth_token', auth_url='your_auth_url')

# Use the connector to make API requests
products = connector.get(connector.products_url)
print(products)

AkeneoPaginator

AkeneoPaginator handles pagination in responses from the Akeneo API. It's designed to work seamlessly with AkeneoConnector, providing an easy way to iterate through pages of API responses.

Features

Easy iteration over paginated responses. Supports navigating to next, previous, first, and last pages. Automatically integrates with AkeneoConnector for API requests.

Usage

Here's how to use AkeneoPaginator to iterate through products:

from akeneo_connector import AkeneoConnector
from akeneo_paginator import AkeneoPaginator

# Initialize the paginator
paginator = AkeneoPaginator(AkeneoPaginator.products_url)

# Fetch and print all products
while paginator.next():
    for product in paginator.items:
        print(product)

# Or iterate over all products directly
for product in paginator:
    print(i, product.identifer)

AkeneoProduct

AkeneoProduct holds the product data from Akeneo to easily get and/or update a certain product in Akeneo. Along with some methods to make it easy to set values with a certain locale or scope.

Features

Easy retrieval of product data Automatically integrates with AkeneoConnector Several methods for retrieving locales, scopes and setting attribute values

Usage

Here's an example of how to use AkeneoProduct:

from akeneo.akeneo_product import AkeneoProduct

# Assume `product_data` is a dictionary containing product information
product = AkeneoProduct(product_data)

# Or retrieve the product by identifier
product = AkeneoProduct().get('1234')

Retrieving Product Attributes You can retrieve locales, scopes, and values of a product attribute:

# Get locales for an attribute
locales = product.get_locales('description')
print(locales)

# Get scopes for an attribute
scopes = product.get_scopes('price')
print(scopes)

# Get values for an attribute
values = product.get_values('size')
print(values)

Setting Product Attributes To update or set the value of a product attribute for a specific locale and scope:

# Set a new value for an attribute
product.set_value('description', locale='en_US', scope='ecommerce', data='New product description')

Fetching a Product To fetch a product by its identifier:

# Fetch a product
fetched_product = product.get('product_identifier')
if fetched_product:
    print("Product fetched successfully.")
else:
    print("Product not found.")

You can get images or other media files associated with a specific attribute from Akeneo products using the get_media method. This method allows you to specify the attribute name, locale, and scope to retrieve the correct media file. To get a media file attribute:

# Get a image attribute for locale en_US and scope ecommerce
product.get_media('thumbnail', locale='en_US', scope='ecommerce')

Metadata

Release files for akeneo-connector 0.1.49

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

Source distribution (sdist)

Source distribution for akeneo-connector 0.1.49
File Size Uploaded
akeneo_connector-0.1.49.tar.gz 12.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for akeneo-connector 0.1.49
File Interpreter ABI Platform
akeneo_connector-0.1.49-py3-none-any.whl Python 3 none any Details

Total release size: 24.8 kB

Release files / akeneo_connector-0.1.49.tar.gz

Download URL akeneo_connector-0.1.49.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
478c19c38780f5c98d0f3aa6d2fc129f081da3cfa8a6340eca98fdef0abca029
BLAKE2b-256 checksum
How to use checksums
771c0a5976e7020de5fb42f1193032449ac431e760931085d909347b5696b128
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / akeneo_connector-0.1.49-py3-none-any.whl

Download URL akeneo_connector-0.1.49-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a54f0810306e32621c714c94399b1667571e7ea23efa182db57588dc0ccce69
BLAKE2b-256 checksum
How to use checksums
8a536dd18fe700a71e33fb6f8be26b39d16040d319d0e44a1bd244d96d917519
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.1.49 This release

2 release files

0.1.48

2 release files

0.1.34

2 release files

0.1.33

2 release files

0.1.32

1 release file

0.1.31

2 release files

0.1.29

2 release files

0.1.28

2 release files

0.1.27

2 release files

0.1.26

2 release files

0.1.25

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

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