Client for several IKEA APIs.
[![License](https://img.shields.io/pypi/l/ikea_api?color=green)](https://github.com/vrslev/ikea-api-client/blob/master/LICENSE)
[![Version](https://img.shields.io/pypi/v/ikea_api?color=green&label=version)](https://pypi.org/project/ikea_api/)
[![Python Version](https://img.shields.io/pypi/pyversions/ikea_api?color=green)](https://pypi.org/project/ikea_api/)
[![Downloads](https://img.shields.io/pypi/dm/ikea_api?color=green)](https://pypi.org/project/ikea_api/)
# 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
```bash
pip install ikea_api
```
If you are planning to use log in as registered user, you need to install Selenium and chromedriver:
```bash
pip install ikea_api[driver]
```
# Initialization
```python
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](https://github.com/vrslev/ikea-api-client/blob/master/src/ikea_api/auth.py)
### [As Guest](https://github.com/vrslev/ikea-api-client/blob/03c1add4fd03fc41a7fef41c35bd2aa9c0c36d4b/src/ikea_api/auth.py#L35-L35)
```python
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](https://github.com/vrslev/ikea-api-client/blob/03c1add4fd03fc41a7fef41c35bd2aa9c0c36d4b/src/ikea_api/auth.py#L56-L56)
Token lasts 1 day. It may take a while to get authorized token because of Selenium usage.
```python
api.login(username=..., password=...)
```
## [Cart](https://github.com/vrslev/ikea-api-client/blob/master/src/ikea_api/endpoints/cart/__init__.py)
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:
```python
cart = api.Cart
cart.add_items({"30457903": 1})
print(cart.show())
```
## [Order Capture](https://github.com/vrslev/ikea-api-client/blob/master/src/ikea_api/endpoints/order_capture/__init__.py)
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](https://github.com/Ephigenia/ikea-availability-checker).
```python
api.OrderCapture(zip_code="101000")
```
## [Purchases](https://github.com/vrslev/ikea-api-client/blob/master/src/ikea_api/endpoints/purchases/__init__.py)
### [Order History](https://github.com/vrslev/ikea-api-client/blob/fc264640ca1f27f4a58c1c57891a917414518a7d/src/ikea_api/endpoints/purchases/__init__.py#L34-L34)
```python
api.login(username=..., password=...)
history = api.Purchases.history()
```
### [Order Info](https://github.com/vrslev/ikea-api-client/blob/fc264640ca1f27f4a58c1c57891a917414518a7d/src/ikea_api/endpoints/purchases/__init__.py#L44-L44)
```python
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](https://github.com/vrslev/ikea-api-client/tree/master/src/ikea_api/endpoints/item)
Get information about item by item number
```python
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](https://github.com/vrslev/ikea-api-client/tree/master/response_examples)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共30个文件
py:19个
txt:4个
pkg-info:2个
资源分类:Python库 所属语言:Python 资源全名:ikea_api-0.2.0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
ikea_api-0.2.0.tar.gz (30个子文件)
ikea_api-0.2.0
PKG-INFO 5KB
pyproject.toml 355B
LICENSE 1KB
src
ikea_api
endpoints
cart
mutations.py 2KB
__init__.py 3KB
queries.py 193B
fragments.py 3KB
order_capture
__init__.py 3KB
purchases
__init__.py 2KB
queries.py 956B
fragments.py 1KB
__init__.py 592B
item
item_iows.py 3KB
__init__.py 2KB
item_ingka.py 1KB
item_pip.py 3KB
constants.py 832B
auth.py 5KB
core.py 2KB
errors.py 1KB
__init__.py 71B
api.py 2KB
ikea_api.egg-info
PKG-INFO 5KB
requires.txt 70B
not-zip-safe 1B
SOURCES.txt 935B
top_level.txt 9B
dependency_links.txt 1B
setup.cfg 894B
README.md 4KB
共 30 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- institutionalNetwork.apk
- MVTec LOCO AD dataset 之 juice-bottle
- opencv 4.10.0 cmake编译cuda支持
- mysql-8.4.0.tar.xz源代码安装包官网下载源 mysql8.X源代码
- LDR6020G PS8742BQFN40GTR-A1 三TYPE-C接口VR转接器应用电路
- 19届智能车字母数据集
- TexturePacker4.8 windows版本
- NX二次开发uf4401 函数介绍
- multisim数字电路课程设计-出租车自动计费器multisim源文件+课设文档说明.zip
- 电脑知识截图(自用,没有太多内容)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功