Compare commits

..

34 commits

Author SHA1 Message Date
Alex Lushpai
9429f1574c
update version matrix (#38)
* update python versions test matrix
* fix workflow file
* fix missing key tests
2024-05-24 22:19:21 +03:00
dependabot[bot]
f17fbc6801
--- (#37)
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-21 18:42:44 +03:00
dependabot[bot]
bd3998f823
Bump requests from 2.21.0 to 2.31.0 (#35)
Bumps [requests](https://github.com/psf/requests) from 2.21.0 to 2.31.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.21.0...v2.31.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-16 18:23:07 +03:00
Alex Lushpai
d0a558a8fe
Update python version (#34) 2024-01-16 18:04:27 +03:00
Alex Lushpai
1c36f3464b
Readme fix 2022-06-17 11:55:02 +03:00
Dmitriy
2c7061d8bf
Bug fix
client.customers_history (and all methods of client) doesn't has parameter filter. It has filters!
2022-04-20 23:17:44 +03:00
Alex Lushpai
3582b077f4
Merge pull request #29 from gwinn/master
minor bump
2021-09-08 16:29:11 +03:00
Alex Lushpai
bfdb4cc554 minor bump 2021-09-08 16:28:10 +03:00
Alex Lushpai
27ff0849ec
Fix Base.parameters. Now they will refresh after making a requests 2021-03-18 15:57:50 +03:00
customr
c52f95e95f Fix Base.parameters. Now they will refresh after making a requests 2021-03-17 21:58:34 +04:00
Alex Lushpai
7c9a81d135
Update README.md 2020-12-18 01:04:43 +03:00
Alex Lushpai
d420bdb0b3
Gh actions (#22) 2020-12-18 01:01:56 +03:00
Alex Lushpai
e3e3de9e4b
Update README.md 2020-12-15 13:31:30 +03:00
Alex Lushpai
b488af91c7
Update product name, cleanup annotations (#21) 2020-12-15 13:31:03 +03:00
Alex Lushpai
963e779172
Downgrade setuptools 2020-08-20 20:43:09 +03:00
Alex Lushpai
f5b7e315bb
Update requirements.txt 2020-08-20 20:40:13 +03:00
Alex Lushpai
4d25347f95
Update requirements.txt 2020-08-20 20:38:19 +03:00
Alex Lushpai
12790245f9
Missed methods, tests (#19) 2020-08-20 14:44:41 +03:00
Alex Lushpai
41084fd4be
Merge pull request #17 from gwinn/master
fixes #14 issue with payment_edit method
2020-02-27 14:10:54 +03:00
Alex Lushpai
30c135380c fixes #14 issue with payment_edit method 2020-02-27 14:09:35 +03:00
Alex Lushpai
b85adb50ca
Update requirements.txt 2020-02-19 15:46:31 +03:00
Alex Lushpai
8dc72b6c90
Merge pull request #16 from gwinn/master
coverage
2020-02-19 15:43:43 +03:00
Alex Lushpai
c198372abb coverage badge 2020-02-19 15:42:36 +03:00
Alex Lushpai
ea22c7266a coverage 2020-02-19 15:40:53 +03:00
Alex Lushpai
6e51a8cfc9
Merge pull request #15 from gwinn/master
Fix tests
2020-02-19 15:30:40 +03:00
Alex Lushpai
a1da7796c4 fix tests 2020-02-19 15:28:27 +03:00
Alex Lushpai
2d45f82287 pyenv file 2020-02-19 14:29:13 +03:00
Alex Lushpai
d4bed324d3
Merge pull request #13 from Alkalit/master
правильная проверка на ошибки
2020-01-09 10:33:07 +03:00
Alex Lushpai
d87c5b3986
Merge pull request #11 from retailcrm/dependabot/pip/requests-2.20.0
Bump requests from 2.18.4 to 2.20.0
2020-01-09 10:32:52 +03:00
Alexey Kalinin
cfb2bb80db правильная проверка на ошибки 2020-01-08 18:49:10 +03:00
dependabot[bot]
a04e807f71
Bump requests from 2.18.4 to 2.20.0
Bumps [requests](https://github.com/requests/requests) from 2.18.4 to 2.20.0.
- [Release notes](https://github.com/requests/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md)
- [Commits](https://github.com/requests/requests/compare/v2.18.4...v2.20.0)

Signed-off-by: dependabot[bot] <support@github.com>
2019-11-02 09:29:18 +00:00
Alex Lushpai
09c6a496e3
Merge pull request #10 from KMityai/master
small fixes
2019-08-16 14:21:46 +03:00
Круглов Дмитрий
15d772079e added init file in "versions" dir 2019-08-15 13:10:27 +03:00
Круглов Дмитрий
f9d81948bf added param "site" in inventories_upload 2019-08-15 11:52:15 +03:00
17 changed files with 9247 additions and 380 deletions

67
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,67 @@
name: ci
on:
push:
branches:
- '**'
tags-ignore:
- '*.*'
pull_request:
env:
RETAILCRM_URL: https://test.retailcrm.pro
RETAILCRM_KEY: key
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
include:
- python-version: '3.12'
coverage: 1
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore=F401
- name: Tests
env:
COVERAGE: ${{ matrix.coverage }}
if: env.COVERAGE != 1
run: python -m unittest tests/*.py
- name: Tests with coverage
env:
COVERAGE: ${{ matrix.coverage }}
if: env.COVERAGE == 1
run: |
coverage run -m unittest tests/*.py
- name: Coverage
env:
COVERAGE: ${{ matrix.coverage }}
if: env.COVERAGE == 1
run: |
bash <(curl -s https://codecov.io/bash)
rm .coverage coverage.xml

5
.gitignore vendored
View file

@ -5,4 +5,7 @@
/dist/
/venv/
/.vscode/
/build/
/build/
.python-version
.coverage
coverage.xml

View file

@ -1,9 +0,0 @@
language: python
python:
- '3.4'
- '3.5'
- '3.6'
before_install:
- pip install -r requirements.txt
script:
- nosetests -v

View file

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015-2018 RetailDriver LLC
Copyright (c) 2015-2021 RetailDriver LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

21
README
View file

@ -1,7 +1,7 @@
retailCRM python API client
RetailCRM python API client
===========================
This is python retailCRM API client. This library allows to use all
This is python RetailCRM API client. This library allows to use all
available API versions.
Install
@ -9,7 +9,7 @@ Install
::
pip install retailcrm
pip3 install retailcrm
Usage
-----
@ -22,7 +22,7 @@ Usage
import retailcrm
client = retailcrm.v3('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
client = retailcrm.v3('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
order = {
'firstName': 'John',
@ -42,7 +42,7 @@ Usage
import retailcrm
client = retailcrm.v4('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
client = retailcrm.v4('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
result = client.customers_history(filter={'sinceId': '1500', 'startDate': '2018-03-01'})
@ -56,7 +56,7 @@ Usage
import retailcrm
client = retailcrm.v5('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
client = retailcrm.v5('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
site = 'example-com'
task = {
'text': 'Product availability problem',
@ -68,12 +68,3 @@ Usage
}
result = client.task_create(task, site)
Documentation
-------------
- `English`_
- `Russian`_
.. _English: http://www.retailcrm.pro/docs/Developers/Index
.. _Russian: http://www.retailcrm.ru/docs/Developers/Index

View file

@ -1,17 +1,18 @@
[![Build Status](https://img.shields.io/travis/retailcrm/api-client-python/master.svg?style=flat-square)](https://travis-ci.org/retailcrm/api-client-python)
[![PyPI](https://img.shields.io/pypi/v/retailcrm.svg?style=flat-square)](https://pypi.python.org/pypi/retailcrm)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/retailcrm.svg?style=flat-square)](https://pypi.python.org/pypi/retailcrm)
[![Build Status](https://github.com/retailcrm/api-client-python/workflows/ci/badge.svg)](https://github.com/retailcrm/api-client-python/actions)
[![Coverage](https://img.shields.io/codecov/c/gh/retailcrm/api-client-python/master.svg?logo=codecov&logoColor=white)](https://codecov.io/gh/retailcrm/api-client-python)
[![PyPI](https://img.shields.io/pypi/v/retailcrm.svg?logo=pypi&logoColor=white)](https://pypi.python.org/pypi/retailcrm)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/retailcrm.svg?logo=python&logoColor=white)](https://pypi.python.org/pypi/retailcrm)
retailCRM python API client
RetailCRM python API client
===========================
This is python retailCRM API client. This library allows to use all available API versions.
This is Python RetailCRM API client. This library allows to use all available API versions.
## Install
```
pip install retailcrm
pip3 install retailcrm
```
## Usage
@ -24,7 +25,7 @@ pip install retailcrm
import retailcrm
client = retailcrm.v3('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
client = retailcrm.v3('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
order = {
'firstName': 'John',
@ -45,9 +46,9 @@ result = client.order_create(order)
import retailcrm
client = retailcrm.v4('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
client = retailcrm.v4('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
result = client.customers_history(filter={'sinceId': '1500', 'startDate': '2018-03-01'})
result = client.customers_history(filters={'sinceId': '1500', 'startDate': '2018-03-01'})
print(result['pagination']['totalCount'])
```
@ -60,7 +61,7 @@ print(result['pagination']['totalCount'])
import retailcrm
client = retailcrm.v5('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
client = retailcrm.v5('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
site = 'example-com'
task = {
'text': 'Product availability problem',
@ -73,8 +74,3 @@ task = {
result = client.task_create(task, site)
```
## Documentation
* [English](http://www.retailcrm.pro/docs/Developers/Index)
* [Russian](http://www.retailcrm.ru/docs/Developers/Index)

View file

@ -1,3 +1,6 @@
multidimensional-urlencode==0.0.4
nose==1.3.7
requests==2.18.4
requests==2.32.1
coverage==4.5.4
pook==1.3.0
setuptools==70.0.0

View file

@ -42,7 +42,7 @@ class Response(object):
"""
:return: collection
"""
errors = {
} if not self.__response_body['errors'] else self.__response_body['errors']
errors = self.__response_body.get('errors', {})
return errors

View file

@ -0,0 +1,5 @@
# coding=utf-8
"""
Init
"""

View file

@ -11,7 +11,7 @@ from retailcrm.response import Response
class Base(object):
"""retailCRM API client"""
"""RetailCRM API client"""
def __init__(self, crm_url, api_key, version):
self.api_url = crm_url + '/api'
@ -30,6 +30,7 @@ class Base(object):
requests_url = base_url + url if not self.parameters else base_url + url + "?" + query_builder(self.parameters)
response = requests.get(requests_url, headers={
'X-API-KEY': self.api_key})
self.parameters = {}
return Response(response.status_code, response.json())
@ -42,7 +43,8 @@ class Base(object):
requests_url = base_url + url
response = requests.post(requests_url, data=self.parameters, headers={
'X-API-KEY': self.api_key})
self.parameters = {}
return Response(response.status_code, response.json())
def api_versions(self):

View file

@ -10,7 +10,7 @@ from retailcrm.versions.base import Base
class Client(Base):
"""retailCRM API client"""
"""RetailCRM API client"""
apiVersion = 'v3'
@ -19,9 +19,9 @@ class Client(Base):
def customers(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -32,8 +32,8 @@ class Client(Base):
def customer_create(self, customer, site=None):
"""
:param customer:
:param site:
:param customer: object
:param site: string
:return: Response
"""
self.parameters['customer'] = json.dumps(customer)
@ -45,8 +45,8 @@ class Client(Base):
def customers_fix_external_ids(self, customers, site=None):
"""
:param customers:
:param site:
:param customers: object
:param site: string
:return: Response
"""
self.parameters['customers'] = json.dumps(customers)
@ -58,8 +58,8 @@ class Client(Base):
def customers_upload(self, customers, site=None):
"""
:param customers:
:param site:
:param customers: array of objects
:param site: string
:return: Response
"""
self.parameters['customers'] = json.dumps(customers)
@ -71,9 +71,9 @@ class Client(Base):
def customer(self, uid, uid_type='externalId', site=None):
"""
:param uid:
:param uid_type:
:param site:
:param uid: string
:param uid_type: string
:param site: string
:return: Response
"""
if uid_type != 'externalId':
@ -86,9 +86,9 @@ class Client(Base):
def customer_edit(self, customer, uid_type='externalId', site=None):
"""
:param customer:
:param uid_type:
:param site:
:param customer: object
:param uid_type: string
:param site: string
:return: Response
"""
self.parameters['customer'] = json.dumps(customer)
@ -103,7 +103,7 @@ class Client(Base):
def orders(self, filters=None, limit=20, page=1):
"""
:param filters: array
:param filters: object
:param limit: integer
:param page: integer
:return: Response
@ -142,11 +142,11 @@ class Client(Base):
def orders_history(self, start=None, end=None, limit=100, offset=0, skip=True):
"""
:param start:
:param end:
:param limit:
:param offset:
:param skip:
:param start: DateTime
:param end: DateTime
:param limit: integer
:param offset: integer
:param skip: boolean
:return: Response
"""
self.parameters['startDate'] = start
@ -215,9 +215,9 @@ class Client(Base):
def packs(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -228,7 +228,7 @@ class Client(Base):
def pack_create(self, pack):
"""
:param pack:
:param pack: object
:return: Response
"""
self.parameters['pack'] = json.dumps(pack)
@ -237,9 +237,9 @@ class Client(Base):
def packs_history(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -250,7 +250,7 @@ class Client(Base):
def pack(self, uid):
"""
:param uid:
:param uid: integer
:return: Response
"""
@ -258,7 +258,7 @@ class Client(Base):
def pack_delete(self, uid):
"""
:param uid:
:param uid: integer
:return: Response
"""
@ -266,7 +266,7 @@ class Client(Base):
def pack_edit(self, pack):
"""
:param pack:
:param pack: object
:return: Response
"""
self.parameters['pack'] = json.dumps(pack)
@ -289,7 +289,7 @@ class Client(Base):
def delivery_services_edit(self, delivery_service):
"""
:param delivery_service:
:param delivery_service: object
:return: Response
"""
self.parameters['deliveryService'] = json.dumps(delivery_service)
@ -305,7 +305,7 @@ class Client(Base):
def delivery_types_edit(self, delivery_type):
"""
:param delivery_type:
:param delivery_type: object
:return: Response
"""
self.parameters['deliveryType'] = json.dumps(delivery_type)
@ -322,7 +322,7 @@ class Client(Base):
def order_methods_edit(self, order_method):
"""
:param order_method:
:param order_method: object
:return: Response
"""
self.parameters['orderMethod'] = json.dumps(order_method)
@ -338,7 +338,7 @@ class Client(Base):
def order_types_edit(self, order_type):
"""
:param order_type:
:param order_type: object
:return: Response
"""
self.parameters['orderType'] = json.dumps(order_type)
@ -354,7 +354,7 @@ class Client(Base):
def payment_statuses_edit(self, payment_status):
"""
:param payment_status:
:param payment_status: object
:return: Response
"""
self.parameters['paymentStatus'] = json.dumps(payment_status)
@ -370,7 +370,7 @@ class Client(Base):
def payment_types_edit(self, payment_type):
"""
:param payment_type:
:param payment_type: object
:return: Response
"""
self.parameters['paymentType'] = json.dumps(payment_type)
@ -386,7 +386,7 @@ class Client(Base):
def product_statuses_edit(self, product_status):
"""
:param product_status:
:param product_status: object
:return: Response
"""
self.parameters['productStatus'] = json.dumps(product_status)
@ -402,7 +402,7 @@ class Client(Base):
def sites_edit(self, site):
"""
:param site:
:param site: object
:return: Response
"""
self.parameters['site'] = json.dumps(site)
@ -411,7 +411,7 @@ class Client(Base):
def status_groups(self):
"""
:return
:return: Response
"""
return self.get('/reference/status-groups')
@ -425,7 +425,7 @@ class Client(Base):
def statuses_edit(self, status):
"""
:param status:
:param status: object
:return: Response
"""
self.parameters['status'] = json.dumps(status)
@ -441,18 +441,18 @@ class Client(Base):
def stores_edit(self, store):
"""
:param store:
:param store: object
:return: Response
"""
self.parameters['status'] = json.dumps(store)
self.parameters['store'] = json.dumps(store)
return self.post('/reference/stores/' + store['code'] + '/edit')
def inventories(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -461,21 +461,25 @@ class Client(Base):
return self.get('/store/inventories')
def inventories_upload(self, offers):
def inventories_upload(self, offers, site=None):
"""
:param offers:
:param offers: array of objects
:param site: string
:return: Response
"""
if site is not None:
self.parameters['site'] = site
self.parameters['offers'] = json.dumps(offers)
return self.post('/store/inventories/upload')
def telephony_call_event(self, phone, call_type, code, status):
"""
:param phone:
:param call_type:
:param code:
:param status:
:param phone: string
:param call_type: string
:param code: string
:param status: string
:return: Response
"""
self.parameters['hangupStatus'] = status
@ -487,7 +491,7 @@ class Client(Base):
def telephony_calls_upload(self, calls):
"""
:param calls:
:param calls: array of objects
:return: Response
"""
self.parameters['calls'] = json.dumps(calls)
@ -496,9 +500,9 @@ class Client(Base):
def telephony_manager(self, phone, details=True):
"""
:param phone:
:param details:
:return: Response
:param phone: string
:param details: string
:return: Response string
"""
self.parameters['phone'] = phone
self.parameters['details'] = details
@ -507,12 +511,12 @@ class Client(Base):
def telephony_settings(self, code, client_id, make_call_url, active, name, image):
"""
:param code:
:param client_id:
:param make_call_url:
:param active:
:param name:
:param image:
:param code: string
:param client_id: string
:param make_call_url: string
:param active: string
:param name: string
:param image: string
:return: Response
"""
self.parameters['code'] = code
@ -523,3 +527,10 @@ class Client(Base):
self.parameters['image'] = image
return self.post('/telephony/settings/' + str(code))
def statistic_update(self):
"""
:return: Response
"""
return self.get('/statistic/update')

View file

@ -10,7 +10,7 @@ from retailcrm.versions.base import Base
class Client(Base):
"""retailCRM API client"""
"""RetailCRM API client"""
apiVersion = 'v4'
@ -19,9 +19,9 @@ class Client(Base):
def customers(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -32,8 +32,8 @@ class Client(Base):
def customer_create(self, customer, site=None):
"""
:param customer:
:param site:
:param customer: object
:param site: string
:return: Response
"""
self.parameters['customer'] = json.dumps(customer)
@ -45,8 +45,8 @@ class Client(Base):
def customers_fix_external_ids(self, customers, site=None):
"""
:param customers:
:param site:
:param customers: array of objects
:param site: string
:return: Response
"""
self.parameters['customers'] = json.dumps(customers)
@ -58,9 +58,9 @@ class Client(Base):
def customers_history(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -71,8 +71,8 @@ class Client(Base):
def customers_upload(self, customers, site=None):
"""
:param customers:
:param site:
:param customers: array of objects
:param site: string
:return: Response
"""
self.parameters['customers'] = json.dumps(customers)
@ -84,9 +84,9 @@ class Client(Base):
def customer(self, uid, uid_type='externalId', site=None):
"""
:param uid:
:param uid_type:
:param site:
:param uid: string
:param uid_type: string
:param site: string
:return: Response
"""
if uid_type != 'externalId':
@ -99,9 +99,9 @@ class Client(Base):
def customer_edit(self, customer, uid_type='externalId', site=None):
"""
:param customer:
:param uid_type:
:param site:
:param customer: object
:param uid_type: string
:param site: string
:return: Response
"""
self.parameters['customer'] = json.dumps(customer)
@ -116,7 +116,7 @@ class Client(Base):
def delivery_setting(self, code):
"""
:param code:
:param code: string
:return: Response
"""
@ -124,17 +124,17 @@ class Client(Base):
def delivery_setting_edit(self, configuration):
"""
:param configuration::
:param configuration: object
:return: Response
"""
self.parameters['configuration'] = json.dumps(configuration)
return self.post('/delivery/generic/setting/' + str(configuration['code'])) + '/edit'
return self.post('/delivery/generic/setting/' + str(configuration['code']) + '/edit')
def delivery_tracking(self, code, status_update):
"""
:param code:
:param status_update:
:param code: string
:param status_update: array of objects
:return: Response
"""
self.parameters['statusUpdate'] = json.dumps(status_update)
@ -143,16 +143,16 @@ class Client(Base):
def marketplace_setting_edit(self, configuration):
"""
:param configuration::
:param configuration: object
:return: Response
"""
self.parameters['configuration'] = json.dumps(configuration)
return self.post('/marketplace/external/setting/' + str(configuration['code'])) + '/edit'
return self.post('/marketplace/external/setting/' + str(configuration['code']) + '/edit')
def orders(self, filters=None, limit=20, page=1):
"""
:param filters: array
:param filters: object
:param limit: integer
:param page: integer
:return: Response
@ -178,7 +178,7 @@ class Client(Base):
def orders_fix_external_ids(self, orders, site=None):
"""
:param orders: object
:param orders: array of objects
:param site: string
:return: Response
"""
@ -191,9 +191,9 @@ class Client(Base):
def orders_history(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -215,7 +215,7 @@ class Client(Base):
def orders_upload(self, orders, site=None):
"""
:param orders: object
:param orders: array of objects
:param site: string
:return: Response
"""
@ -260,9 +260,9 @@ class Client(Base):
def packs(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -273,7 +273,7 @@ class Client(Base):
def pack_create(self, pack):
"""
:param pack:
:param pack: object
:return: Response
"""
self.parameters['pack'] = json.dumps(pack)
@ -282,9 +282,9 @@ class Client(Base):
def packs_history(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -295,7 +295,7 @@ class Client(Base):
def pack(self, uid):
"""
:param uid:
:param uid: integer
:return: Response
"""
@ -303,7 +303,7 @@ class Client(Base):
def pack_delete(self, uid):
"""
:param uid:
:param uid: integer
:return: Response
"""
@ -311,7 +311,7 @@ class Client(Base):
def pack_edit(self, pack):
"""
:param pack:
:param pack: object
:return: Response
"""
self.parameters['pack'] = json.dumps(pack)
@ -334,7 +334,7 @@ class Client(Base):
def delivery_services_edit(self, delivery_service):
"""
:param delivery_service:
:param delivery_service: object
:return: Response
"""
self.parameters['deliveryService'] = json.dumps(delivery_service)
@ -350,7 +350,7 @@ class Client(Base):
def delivery_types_edit(self, delivery_type):
"""
:param delivery_type:
:param delivery_type: object
:return: Response
"""
self.parameters['deliveryType'] = json.dumps(delivery_type)
@ -367,7 +367,7 @@ class Client(Base):
def order_methods_edit(self, order_method):
"""
:param order_method:
:param order_method: object
:return: Response
"""
self.parameters['orderMethod'] = json.dumps(order_method)
@ -383,7 +383,7 @@ class Client(Base):
def order_types_edit(self, order_type):
"""
:param order_type:
:param order_type: object
:return: Response
"""
self.parameters['orderType'] = json.dumps(order_type)
@ -399,7 +399,7 @@ class Client(Base):
def payment_statuses_edit(self, payment_status):
"""
:param payment_status:
:param payment_status: object
:return: Response
"""
self.parameters['paymentStatus'] = json.dumps(payment_status)
@ -431,7 +431,7 @@ class Client(Base):
def price_types_edit(self, price_type):
"""
:param price_type:
:param price_type: object
:return: Response
"""
self.parameters['priceType'] = json.dumps(price_type)
@ -447,7 +447,7 @@ class Client(Base):
def product_statuses_edit(self, product_status):
"""
:param product_status:
:param product_status: object
:return: Response
"""
self.parameters['productStatus'] = json.dumps(product_status)
@ -463,7 +463,7 @@ class Client(Base):
def sites_edit(self, site):
"""
:param site:
:param site: object
:return: Response
"""
self.parameters['site'] = json.dumps(site)
@ -486,7 +486,7 @@ class Client(Base):
def statuses_edit(self, status):
"""
:param status:
:param status: object
:return: Response
"""
self.parameters['status'] = json.dumps(status)
@ -502,18 +502,18 @@ class Client(Base):
def stores_edit(self, store):
"""
:param store:
:param store: object
:return: Response
"""
self.parameters['status'] = json.dumps(store)
self.parameters['store'] = json.dumps(store)
return self.post('/reference/stores/' + store['code'] + '/edit')
def inventories(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -522,18 +522,22 @@ class Client(Base):
return self.get('/store/inventories')
def inventories_upload(self, offers):
def inventories_upload(self, offers, site=None):
"""
:param offers:
:param offers: array of objects
:param site: string
:return: Response
"""
if site is not None:
self.parameters['site'] = site
self.parameters['offers'] = json.dumps(offers)
return self.post('/store/inventories/upload')
def prices_upload(self, prices):
"""
:param prices:
:param prices: array of objects
:return: Response
"""
self.parameters['prices'] = json.dumps(prices)
@ -542,7 +546,7 @@ class Client(Base):
def products(self, filters=None, limit=20, page=1):
"""
:param filters: array
:param filters: object
:param limit: integer
:param page: integer
:return: Response
@ -555,7 +559,7 @@ class Client(Base):
def store_setting(self, code):
"""
:param code:
:param code: string
:return: Response
"""
@ -563,16 +567,16 @@ class Client(Base):
def store_setting_edit(self, configuration):
"""
:param configuration::
:param configuration: object
:return: Response
"""
self.parameters['configuration'] = json.dumps(configuration)
return self.post('/store/setting/' + str(configuration['code'])) + '/edit'
return self.post('/store/setting/' + str(configuration['code']) + '/edit')
def telephony_call_event(self, event):
"""
:param event:
:param event: object
:return: Response
"""
self.parameters['event'] = json.dumps(event)
@ -581,27 +585,29 @@ class Client(Base):
def telephony_calls_upload(self, calls):
"""
:param calls:
:param calls: array of objects
:return: Response
"""
self.parameters['calls'] = json.dumps(calls)
return self.post('/telephony/calls/upload')
def telephony_manager(self, phone, details=True):
def telephony_manager(self, phone, details=True, ignore_status=False):
"""
:param phone:
:param details:
:param phone: string
:param details: string
:param ignore_status: string
:return: Response
"""
self.parameters['phone'] = phone
self.parameters['details'] = details
self.parameters['ignoreStatus'] = ignore_status
return self.get('/telephony/manager')
def telephony_setting(self, code):
"""
:param code:
:param code: string
:return: Response
"""
@ -609,12 +615,12 @@ class Client(Base):
def telephony_setting_edit(self, configuration):
"""
:param configuration::
:param configuration: object
:return: Response
"""
self.parameters['configuration'] = json.dumps(configuration)
return self.post('/telephony/setting/' + str(configuration['code'])) + '/edit'
return self.post('/telephony/setting/' + str(configuration['code']) + '/edit')
def user_groups(self, limit=20, page=1):
"""
@ -629,7 +635,7 @@ class Client(Base):
def users(self, filters=None, limit=20, page=1):
"""
:param filters: array
:param filters: object
:param limit: integer
:param page: integer
:return: Response
@ -642,8 +648,15 @@ class Client(Base):
def user(self, uid):
"""
:param uid:
:param uid: integer
:return: Response
"""
return self.get('/users/' + str(uid))
def statistic_update(self):
"""
:return: Response
"""
return self.get('/statistic/update')

File diff suppressed because it is too large Load diff

View file

@ -15,17 +15,17 @@ def read(filename):
setup(
name='retailcrm',
version='5.0.3',
description='retailCRM API client',
version='5.1.2',
description='RetailCRM API client',
long_description=read('README'),
url='https://github.com/retailcrm/api-client-python',
author='retailCRM',
author_email='integration@retailcrm.ru',
author='RetailCRM',
author_email='support@retailcrm.pro',
keywords='crm saas rest e-commerce',
license='MIT',
packages=['retailcrm', 'retailcrm/versions'],
package_data={},
install_requires=['requests', 'multidimensional_urlencode', 'nose'],
install_requires=['requests', 'multidimensional_urlencode', 'nose', 'coverage', 'pook', 'setuptools'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Other Environment',
@ -34,9 +34,11 @@ setup(
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Software Development :: Libraries :: Python Modules',
]

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff