Skip to main content

python-copaco-connections

Easy python integrations for the Copaco Customer Connections

Package use

This package has three main functions:

  • Retrieve the pricelist of Copaco
  • Send orders to Copaco
  • Retrieve order responses

These three functions will be explained seperately below.

You need to requests a connection with Copaco first before you can use this package. More info here: https://www.copaco.com/en-be/customer-service-e-commerce-fulfillment

Getting started

Install

Install with pip.

pip install python-copaco-connections

Pricelist

Limitations

The pricelist is limited to the Copaco BE - Dutch Productlist in CSV format via FTP. Might be extended in the future.

Import

Import the package and the CopacoConnectionBE object.

from copaco.connection import CopacoConnectionBE

Setup connection

Make the connection with your provided FTP credentials.

conn = CopacoConnectionBE(FTP_HOST, FTP_LOGIN, FTP_PASSWD)

Retrieve the pricelist

You can retrieve the pricelist as follows:

priceList = conn.priceList.get()

This will return an ordinary list which contains PriceListItem objects.

You can find the attributes of this object and their use below:

PriceListItem object

Attribute Contains Type
article Article number string
vendorCode Unique vendor code string
description Short description string
price Price, excluding levies float
priceWithLevies Price, including levies float
stock Amount of stock available integer
hierarchy Product hierarchy string
unspscCode UNSPSC code string
EAN EAN code string
statusCode Status code (0 - 12). Refer to docs. integer
status Human-readable status string
auvibel Price of Auvibel float
reprobel Price of Reprobel float
recupel Price of Recupel float
bebat Price of Bebat float
nextDelivery Next delivery date of this product date
nextDeliveryAmount Amount that will be delivered on next delivery integer
inventoryStatusCode ATP code string
inventoryStatus Human-readable ATP code string

Sample script

You can find a sample script at examples/get-pricelist.py

Orders

Limitations

Fields that are not supported at this moment:

  • end-user_information
  • orderline_info
  • registration_info
  • notification

Import

Import the package and the CopacoOrders object.

from copaco.orders import CopacoOrders

Setup connection

Make the connection with your Customer ID and provided Sender ID for orders.

orders = CopacoOrders(CUSTOMER_ID, SENDER_ID)

Create a new order

Before creating an order you have to understand that creating an order does not equal sending the order to Copaco for processing. You need to create the order internally first, and then send the order over to Copaco.

orders = CopacoOrders(CUSTOMER_ID, SENDER_ID)
order = orders.create(external_document_id, supplier, customer_ordernumber, completedelivery, requested_deliverydate=None, recipientsreference=None)

The above function is a simplified function that allows you to create a basic Order object, with no lines attached to it.

Param Required? Type Format Remarks
external_document_id X string Free text field Contains an unique number or token from your system
supplier X string 'COPACO'/'6010' 'COPACO' = Copaco NL, '6010' = Copaco BE
customer_ordernumber X string Free text field Contains an unique purchase order number from your system
completedelivery X string 'Y'/'N' 'Y' = Complete delivery, 'N' = Partial delivery allowed
requested_deliverydate string 'DD-MM-YYYY' Date you would like the order to be delivered
recipientsreference string Free text field Reference for the goods receiver

Attach lines to an existing order

You can attach lines to an existing order.

order.addOrderLine(item_id, tag, quantity, price=None, currency=None, deliverydate=None, textqualifier=None, text=None)
Param Required? Type Format Remarks
item_id X string Free text field Contains the part number
tag X string 'PN'/'MF'/'CU' 'PN' = Supplier part number, 'MF' = Manufacturer part number, 'CU' = Customer part number
quantity X integer integer Only full numbers allowed
price float float Must match with the price in ERP system or within agreed margins
currency string 'EUR' At this moment only 'EUR' is allowed, might be extended later
deliverydate string 'DD-MM-YYYY' Date you would like the line to be delivered. Overrules delivery date on the order.
textqualifier string '0001'/'BID' '0001' = Instruction line, 'BID' = Line contains special BID
text string Free text field If qualifier '0001' = Free text field, If qualifier 'BID' = Special BID number

Set shipping address

You can set the shipping address of an order if you would like to ship to another address that is not your default. If no shipping address is supplied, your default address will be used.

order.setShippingAdress(firstname, lastname, street, postalcode, city, country)

Country has to be the country code.

Send order to Copaco

Once the full order has been created, you can send the order to Copaco for processing.

orders = CopacoOrders(CUSTOMER_ID, SENDER_ID)
order = orders.create(external_document_id, supplier, customer_ordernumber, completedelivery)
orders.sendToCopaco(order)

Sample script

You can find a sample script at examples/create-order.py

Order responses

Limitations

Not all fields are supported at this moment. List of unsupported fields is not available at this moment.

Import

Import the package and the CopacoOrders object.

from copaco.orders import CopacoOrders

Setup connection

Make the connection with your Customer ID and provided Sender ID for orders.

orders = CopacoOrders(CUSTOMER_ID, SENDER_ID)

Retrieve responses

Copaco has four different responses.

Response type Contains
INT Initial response. Indicates that the order is received.
OBV Order confirmation. Contains information on how the order is processed.
FAC Invoice in XML format.
PAK Dispatch advice response. Generated after the goods are picked and ready for shipment.

You can retrieve these responses seperately or all at once.

orders = CopacoOrders(CUSTOMER_ID, SENDER_ID)
intResponses = orders.getResponses(type='INT')
obvResponses = orders.getResponses(type='OBV')
pakResponses = orders.getResponses(type='PAK')
facResponses = orders.getResponses(type='FAC')
allResponses = orders.getResponses(type='ALL')

Requesting a specific type will return an array that contains objects of the XML returned. Requesting all types will return a dictionary with the following format:

{
  'INT' : [intResponses], 
  'OBV' : [obvResponses],
  'FAC' : [facResponses],
  'PAK' : [pakResponses]
}

Structure

The structure of these responses are the same as the XML that is returned, and thus is defined by Copaco. Be aware that there are a lot of inconsistencies in the XML format: camelCase, snake_case, PascalCase are all used.

Refer to the XML documentation to know the structure.

Sample script

You can find example responses for each type at examples/xml-responses

You can find a sample script for each response at examples/get-response-XXX.py where XXX is the type.

Metadata

Release files for python-copaco-connections 1.0.1

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

Source distribution (sdist)

Source distribution for python-copaco-connections 1.0.1
File Size Uploaded Provenance Actions
python-copaco-connections-1.0.1.tar.gz 28.0 kB Without provenance Details for python-copaco-connections-1.0.1.tar.gz

Release files / python-copaco-connections-1.0.1.tar.gz

Download URL python-copaco-connections-1.0.1.tar.gz
Size 28.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b4bad20658b9667d8eb82b2e1d5442d0c67d374a43c2ce47058b35b29a7dbec4
BLAKE2b-256 checksum
How to use checksums
09d5de7656b9a8af76e0a8de456b52242737583f177adb910133624f6c2111ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.4

Security for python-copaco-connections 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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