- Fix the type hints of
order_id
inget_order
,hold_order
,unhold_order
- Add
add_product_website_link
andremove_product_website_link
-
Remove the functions deprecated since 1.11.2 and before:
set_product_stock_item
,delete_default_source_items
,VISIBILITY_BOTH
-
Some functions that were previously returning a
requests.Response
object now return the JSON-parsed payload:add_product_to_category
assign_attribute_set_attribute
delete_attribute
delete_product_media
delete_source_items
delete_special_prices
hold_order
link_child_product
remove_category
remove_attribute_set_attribute
remove_product_from_category
save_base_prices
save_configurable_product_option
save_special_prices
unlink_child_product
unhold_order
This means they raise in case of error response instead of silently ignoring it.
- All methods now pass down their additional
**kwargs
to the underlyingrequest_api
method call - Add official support for Python 3.13.0-rc.1
- Allow to override the
scope
on a per-request basis
delete_source_items_by_source_code
: don't call the Magento API if there is no item to delete
get_order
,get_bulk_status
,get_customer
,get_invoice
,get_product_stock_item
,get_product_stock_status
: add keyword parameternone_on_404
get_order_item
: accept the item ID as a positional argument- Add
delete_source_items_by_source_code
and deprecatedelete_default_source_items
- Bump
api-session
to 1.4.1
- Add
get_order_item
,get_customer("me")
- Add
get_current_customer
,activate_current_customer
,change_current_customer_password
- Add
get_countries
,get_country
get_cart
now accepts the cart ID as a positional argument (not only as a keyword argument)- Expose
magento.types.*
undermagento
- Escape path arguments in all calls
get_category_by_name
: addassert_one
optional keyword parameter- Add
move_category
,get_child_categories
create_category
now returns the created category rather than aResponse
object
- fix
get_source_items
to accept an empty list of SKUs. In previous versionsskus=[]
(filter on an empty list) was interpreted the same way asskus=None
(don’t filter at all) - fix
get_store_configs
to accept an empty list ofstore_codes
update_product_stock_item
: improve the docstring
- Implement more methods:
get_apple_pay_auth
get_bulk_operations
,get_bulk_detailed_status
,get_bulk_operation_status_count
update_product_stock_item
- Add
update_product_stock_item_quantity
and deprecateset_product_stock_item
- Allow to override the
page_size
inget_paginated
and all methods that use it
- Implement more methods:
get_cms_block
,delete_cms_block
create_coupon
,update_coupon
,get_coupon
,delete_coupon
,delete_coupons
,delete_coupons_by_codes
delete_customer_address
- Add helpers
sku_exists
,sku_was_bought
,get_categories_under_root
remove_product_from_category
: fix for SKUs that contain slashes- Improve some type hints on attributes methods
save_product
: addlog_response
to be able to disable the log of the Magento response- Add
delete_custom_attribute
anddelete_custom_attributes
- Deprecate
VISIBILITY_BOTH
in favor ofVISIBILITY_IN_CATALOG_AND_SEARCH
- Simplify some code using
api-session
1.3.6
get_order
andsave_attribute
: remove thethrow
parameter; the default wasTrue
but even if one passedFalse
the method would still throw when trying to JSON-decode the error responses.
- Add
get_cart
BatchSaver.send_batch
now returns the response from the Magento API
- Add
remove_category
- Limit the query made by
get_category_by_name
to a single result
- Add
get_category_products
,add_product_to_category
, andremove_product_from_category
get_categories
: add optionalpath_prefix
to filter categories by path- Add
magento.parse_datetime
- Add
magento.IMAGE_MIME_TYPES
andmagento.DATE_ISO_8601_FORMAT
- Remove
magento.DEFAULT_ROOT_CATEGORY_ID
as it can be confusing. Useclient.get_root_category_id()
instead.
- Add
get_store_configs
,get_store_groups
,get_store_views
,get_websites
- Add helpers
get_current_store_group_id
,get_root_category_id
- All path components are now properly escaped in API calls
- Fix calls when using scope
default
- Add official support for Python 3.12
get_product_media
: the second parameter is now calledmedia_id
instead ofentry_id
to be coherent with the APImagento.DEFAULT_CATEGORY_ID
is now namedmagento.DEFAULT_ROOT_CATEGORY_ID
- Allow to override
Magento.PAGE_SIZE
when creating a client with thebatch_page_size
keyword argument - Remove
Magento.TOKEN_LIFETIME
; it wasn’t used for anything
- Uniformize the signatures of functions that return a generator. The following functions now support a
limit
:get_categories
(#3),get_stock_source_links
,get_sources
. All these function now pass their additional keyword arguments to the internalself.get_paginated
call.
- Add
get_source
,get_sources
,save_source
- Support SKUs that contain slashes
- Pass additional keyword arguments in
Magento()
to the underlyingAPISession()
constructor - Remove the
verbose
optional keyword option as well as thelog_response
parameter. Instead, use theDEBUG
level for logging. Instead of setting these variables toTrue
, set your logger level toDEBUG
.
- Fix
coerce_as
for list values inget_custom_attribute
. The function now correctly gets each individual value rather than the whole list. - Fix type hint for list values in
get_custom_attribute
- Remove
Magento.get_product_source_items
(deprecated since 1.3.3) - Remove
pretty_custom_attributes
(deprecated since 1.3.4) - Remove
log_progress
parameter toMagento
(deprecated since 1.4.0) get_custom_attribute
: add a more precise type hint on the return type
- Add
get_product_by_query
set_custom_attributes
,set_custom_attribute
andserialize_attribute_value
now support an optionalforce_none=True
to preventNone
values from being serialized as empty string. This can be useful to erase attributes.MagentoAssertionError
is now accessible from themagento
module (magento.MagentoAssertionError
)
save_product
:log_response
must now be passed as a keyword argument. Before, you could use.save_product(p, True)
; now you muse use.save_product(p, log_response=True)
.update_product
’s second argument is now calledproduct
instead ofproduct_data
to be consistent withsave_product
.
- Add
get_credit_memos
andget_modules
- Add
get_manufacturers
as a shortcut forget_products_attribute_options("manufacturer")
get_source_items
can now take a list ofskus
instead of a single onesave_product
andupdate_product
now accept an optionalsave_options
boolean- Fix type hint of the
logger
parameter of the constructor ofMagento
get_order_shipping_address
now return a reference to the shipping address instead of a modified copy. This is a breaking change if you relied on this value to be a copy of the shipping address.- Add
magento.format_datetime
- Rename the parameter
log_progress
toverbose
. Keeplog_progress
as an alias for backward compatibility.
- Fix a bug in
BatchSaver
where thebatch_size
constructor argument was ignored - Deprecate
pretty_custom_attributes
; use your own function instead - Add
set_custom_attributes
andserialize_attribute_value
functions - Add
sort_orders
optional argument tomake_field_value_query
- The dictionary returned by
get_custom_attributes_dict
is now ordered
- Deprecate
get_product_source_items(sku)
in favor ofget_source_items(sku=sku)
, which returns exactly the same data - Add
get_stock_source_links
,get_product_stock_item
andget_product_stock_status
methods - Add
set_custom_attribute
function - Document parameters of
unlink_child_product
- Improve docstrings of
magento.batches
- Add missing search endpoints:
get_carts
,get_cms_blocks
,get_cms_pages
,get_coupons
,get_customer_groups
,get_sales_rules
,get_tax_rates
,get_tax_rules
- Fix
get_products_attribute_options
that wasn’t throwing if it received an error response from Magento. - Improve some docstrings
- Add support for environment variables as a fallback for
Magento()
arguments:PYMAGENTO_TOKEN
,PYMAGENTO_BASE_URL
,PYMAGENTO_SCOPE
,PYMAGENTO_USER_AGENT
- Fix
user_agent
support (api-session
1.1.1)
- Add
get_base_prices
- Fix
get_special_prices
that was throwing an error whenread_only
was true
- Add
save_product_media
,delete_product_media
,save_configurable_product_option
,save_base_prices
,get_special_prices
,save_special_prices
,delete_special_prices
,delete_special_prices_by_sku
,create_category
,ship_order
- Minor type hints improvements
First public release.