IKEA API Client
Project description
Client for several IKEA APIs.
Features
- Authorization (as guest or as user)
- Manage Cart
- Check available Delivery Services
- Retrieve Purchases History and information about specific order
- Fetch Product information
Installation
pip install ikea_api
To use authorization you need to have Chrome on board.
Initialization
from ikea_api import IkeaApi
api = IkeaApi(
token=..., # If you already have a token and stored it somewhere
country_code="ru",
language_code="ru",
)
Endpoints
Authorization
As Guest
api.login_as_guest()
First time you open IKEA.com guest token is being generated and stored in Cookies. It expires in 30 days.
As Registered User
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=...)
Cart
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())
Order Capture
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")
Purchases
Order History
api.login(username=..., password=...)
history = api.Purchases.history()
Order Info
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=...)
Item Specs
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.
Response Examples
You can review response examples for all endpoint before using it here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.