Skip to main content

IKEA API Client

Project description

Client for several IKEA APIs.

License Version Python Version Downloads

Features

  • Authorization (as guest or as user)
  • Cart managing
  • Available Delivery Services checking
  • Purchase History and specific Purchase Info getting
  • Item Info fetching

Installation

This package requires Python >=3.7

python3 -m pip install ikea_api

This project uses Flit for distribution. To install it locally (for development) do this:

python3 -m pip install flit
git clone https://github.com/vrslev/ikea-api-client
cd ikea-api-client
flit install -s

Endpoints

Authorization

Get Guest Token

from ikea_api import get_guest_token
token = get_guest_token()

First time you open IKEA.com guest token is being generated and stored in Cookies. It expires in 30 days.

Get Authorized Token

IKEA uses OAuth2 to authorize their users. It lasts 1 day.

from ikea_api import get_authorized_token
token = get_authorized_token('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:

from ikea_api import Cart

token = ...
cart = Cart(token)
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.

from ikea_api import Cart, OrderCapture

token = ...

cart = Cart(token)
cart.add_items({"30457903": 1})

order_capture = OrderCapture(token, zip_code="101000")
services = order_capture.get_delivery_services()
print(services)

Purchases

Order History

from ikea_api import Purchases

authorized_token = ...

purchases = Purchases(authorized_token)
print(purchases.history())

Order Info

from ikea_api import Purchases

order_number = ...

authorized_token = ...
purchases = Purchases(authorized_token)
order = purchases.order_info(order_number)

# Or use it without authorization, email is required
guest_token = ...
purchases = Purchases(guest_token)
order = purchases.order_info(order_number, email="email@example.com")

print(order)

Item Specs

Get information about item by item number

from ikea_api import fetch_items_specs

item_codes = ["30457903"]

items = fetch_items_specs.iows(item_codes)

# or
items = fetch_items_specs.ingka(item_codes)

# or
item_codes_dict = {d: True for d in items} # True — is SPR i. e. combination
items = 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ikea_api-0.1.6.tar.gz (15.9 kB view hashes)

Uploaded Source

Built Distribution

ikea_api-0.1.6-py3-none-any.whl (20.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page