Client for several IKEA APIs.
- Authorization (as guest or as user)
- Manage Cart
- Check available Delivery Services
- Retrieve Purchases History and information about specific order
- Fetch Product information
pip install ikea_api
To use authorization you need to have Chrome on board.
from ikea_api import IkeaApi
api = IkeaApi(
token=..., # If you already have a token and stored it somewhere
country_code="ru",
language_code="ru",
)
api.login_as_guest()
First time you open IKEA.com guest token is being generated and stored in Cookies. It expires in 30 days.
Token lasts 1 day. It may take a while to get authorized token because of it uses headless Chrome to proceed. Note, that Chrome is required to login.
api.login(username=..., password=...)
This API endpoint allows you to do everything you would be able to do on the site, and even more:
- Add, Delete and Update items
- Show cart
- Clear cart
- Set and Delete Coupon
- Copy cart from another user
Works with and without authorization. If you logged in all changes apply to the real cart. Use case: programmatically add items to cart and order it manually on IKEA.com.
Example:
cart = api.Cart
cart.add_items({"30457903": 1})
print(cart.show())
Check availability for Pickup or Delivery. This is the only way.
If you need to know whether items are available in stores, check out ikea-availability-checker.
api.OrderCapture(zip_code="101000")
api.login(username=..., password=...)
history = api.Purchases.history()
api.login(username=..., password=...)
order = api.Purchases.order_info(order_number=...)
# Or use it without authorization, email is required
api.login_as_guest()
order = api.order_info(order_number=..., email=...)
Get information about item by item number
item_codes = ["30457903"]
items = api.fetch_items_specs.iows(item_codes)
# or
items = api.fetch_items_specs.ingka(item_codes)
# or
item_codes_dict = {d: True for d in items} # True — is SPR i. e. combination
items = api.fetch_items_specs.pip(item_codes_dict)
There are many ways because information about some items is not available in some endpoints.
You can review response examples for all endpoint before using it here