Update product name, cleanup annotations (#21)

This commit is contained in:
Alex Lushpai 2020-12-15 13:31:03 +03:00 committed by GitHub
parent 963e779172
commit b488af91c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 65 deletions

View File

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

19
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. available API versions.
Install Install
@ -22,7 +22,7 @@ Usage
import retailcrm import retailcrm
client = retailcrm.v3('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc') client = retailcrm.v3('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
order = { order = {
'firstName': 'John', 'firstName': 'John',
@ -42,7 +42,7 @@ Usage
import retailcrm 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(filter={'sinceId': '1500', 'startDate': '2018-03-01'})
@ -56,7 +56,7 @@ Usage
import retailcrm import retailcrm
client = retailcrm.v5('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc') client = retailcrm.v5('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
site = 'example-com' site = 'example-com'
task = { task = {
'text': 'Product availability problem', 'text': 'Product availability problem',
@ -68,12 +68,3 @@ Usage
} }
result = client.task_create(task, site) result = client.task_create(task, site)
Documentation
-------------
- `English`_
- `Russian`_
.. _English: https://help.retailcrm.pro/Developers/Index
.. _Russian: https://help.retailcrm.ru/Developers/Index

View File

@ -1,13 +1,13 @@
[![Build Status](https://img.shields.io/travis/retailcrm/api-client-python/master.svg?style=flat-square)](https://travis-ci.org/retailcrm/api-client-python) [![Build Status](https://img.shields.io/travis/retailcrm/api-client-python/master.svg)](https://travis-ci.org/retailcrm/api-client-python)
[![Coverage](https://img.shields.io/codecov/c/gh/retailcrm/api-client-python/master.svg?style=flat-square)](https://codecov.io/gh/retailcrm/api-client-python) [![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?style=flat-square)](https://pypi.python.org/pypi/retailcrm) [![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?style=flat-square)](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 ## Install
@ -25,7 +25,7 @@ pip install retailcrm
import retailcrm import retailcrm
client = retailcrm.v3('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc') client = retailcrm.v3('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
order = { order = {
'firstName': 'John', 'firstName': 'John',
@ -46,7 +46,7 @@ result = client.order_create(order)
import retailcrm 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(filter={'sinceId': '1500', 'startDate': '2018-03-01'})
@ -61,7 +61,7 @@ print(result['pagination']['totalCount'])
import retailcrm import retailcrm
client = retailcrm.v5('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc') client = retailcrm.v5('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
site = 'example-com' site = 'example-com'
task = { task = {
'text': 'Product availability problem', 'text': 'Product availability problem',
@ -74,8 +74,3 @@ task = {
result = client.task_create(task, site) result = client.task_create(task, site)
``` ```
## Documentation
* [English](https://help.retailcrm.pro/Developers/Index)
* [Russian](https://help.retailcrm.ru/Developers/Index)

View File

@ -11,7 +11,7 @@ from retailcrm.response import Response
class Base(object): class Base(object):
"""retailCRM API client""" """RetailCRM API client"""
def __init__(self, crm_url, api_key, version): def __init__(self, crm_url, api_key, version):
self.api_url = crm_url + '/api' self.api_url = crm_url + '/api'

View File

@ -10,7 +10,7 @@ from retailcrm.versions.base import Base
class Client(Base): class Client(Base):
"""retailCRM API client""" """RetailCRM API client"""
apiVersion = 'v3' apiVersion = 'v3'

View File

@ -10,7 +10,7 @@ from retailcrm.versions.base import Base
class Client(Base): class Client(Base):
"""retailCRM API client""" """RetailCRM API client"""
apiVersion = 'v4' apiVersion = 'v4'

View File

@ -10,7 +10,7 @@ from retailcrm.versions.base import Base
class Client(Base): class Client(Base):
"""retailCRM API client""" """RetailCRM API client"""
apiVersion = 'v5' apiVersion = 'v5'

View File

@ -16,11 +16,11 @@ def read(filename):
setup( setup(
name='retailcrm', name='retailcrm',
version='5.1.0', version='5.1.0',
description='retailCRM API client', description='RetailCRM API client',
long_description=read('README'), long_description=read('README'),
url='https://github.com/retailcrm/api-client-python', url='https://github.com/retailcrm/api-client-python',
author='retailCRM', author='RetailCRM',
author_email='integration@retailcrm.ru', author_email='support@retailcrm.pro',
keywords='crm saas rest e-commerce', keywords='crm saas rest e-commerce',
license='MIT', license='MIT',
packages=['retailcrm', 'retailcrm/versions'], packages=['retailcrm', 'retailcrm/versions'],

View File

@ -2,7 +2,7 @@
""" """
retailCRM API client v3 tests RetailCRM API client v3 tests
""" """
from urllib.parse import urlencode from urllib.parse import urlencode
@ -124,7 +124,7 @@ class TestVersion3(unittest.TestCase):
V3 Test wrong api url V3 Test wrong api url
""" """
(pook.get('https://epoqq.retailcrm.ru' + '/api/v3/statistic/update') (pook.get('https://epoqq.retailcrm.pro' + '/api/v3/statistic/update')
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')}) .headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
.reply(404) .reply(404)
.headers(self.__header) .headers(self.__header)
@ -136,7 +136,7 @@ class TestVersion3(unittest.TestCase):
) )
) )
client = retailcrm.v3('https://epoqq.retailcrm.ru', os.getenv('RETAILCRM_KEY')) client = retailcrm.v3('https://epoqq.retailcrm.pro', os.getenv('RETAILCRM_KEY'))
response = client.statistic_update() response = client.statistic_update()
pook.off() pook.off()
@ -1572,7 +1572,7 @@ class TestVersion3(unittest.TestCase):
'firstName': 'yyy', 'firstName': 'yyy',
'lastName': 'xxxx', 'lastName': 'xxxx',
'patronymic': 's789', 'patronymic': 's789',
'email': 'mail@retailcrm.ru', 'email': 'mail@retailcrm.pro',
'code': 'ccc7' 'code': 'ccc7'
}, },
'customer': { 'customer': {
@ -1581,7 +1581,7 @@ class TestVersion3(unittest.TestCase):
'firstName': 'ccc', 'firstName': 'ccc',
'lastName': 's789', 'lastName': 's789',
'patronymic': 's789', 'patronymic': 's789',
'email': 'mail@retailcrm.ru', 'email': 'mail@retailcrm.pro',
'code': 'ccc7', 'code': 'ccc7',
'phones': [{'number': '+71111111111'}] 'phones': [{'number': '+71111111111'}]
}, },

View File

@ -2,7 +2,7 @@
""" """
retailCRM API client v4 tests RetailCRM API client v4 tests
""" """
from urllib.parse import urlencode from urllib.parse import urlencode
@ -120,7 +120,7 @@ class TestVersion4(unittest.TestCase):
V4 Test wrong api url V4 Test wrong api url
""" """
(pook.get('https://epoqq.retailcrm.ru' + '/api/v4/statistic/update') (pook.get('https://epoqq.retailcrm.pro' + '/api/v4/statistic/update')
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')}) .headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
.reply(404) .reply(404)
.headers(self.__header) .headers(self.__header)
@ -132,7 +132,7 @@ class TestVersion4(unittest.TestCase):
) )
) )
client = retailcrm.v4('https://epoqq.retailcrm.ru', os.getenv('RETAILCRM_KEY')) client = retailcrm.v4('https://epoqq.retailcrm.pro', os.getenv('RETAILCRM_KEY'))
response = client.statistic_update() response = client.statistic_update()
pook.off() pook.off()
@ -1690,7 +1690,7 @@ class TestVersion4(unittest.TestCase):
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v4/store/inventories') (pook.get(os.getenv('RETAILCRM_URL') + '/api/v4/store/inventories')
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')}) .headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
.params({'filter[site]': 'https://retailcrm.ru'}) .params({'filter[site]': 'https://retailcrm.pro'})
.reply(200) .reply(200)
.headers(self.__header) .headers(self.__header)
.json( .json(
@ -1706,13 +1706,13 @@ class TestVersion4(unittest.TestCase):
{ {
'id': 33937, 'id': 33937,
'externalId': 'werew', 'externalId': 'werew',
'site': 'https://retailcrm.ru', 'site': 'https://retailcrm.pro',
'quantity': 102 'quantity': 102
}, },
{ {
'id': 33933, 'id': 33933,
'externalId': '46', 'externalId': '46',
'site': 'https://retailcrm.ru', 'site': 'https://retailcrm.pro',
'quantity': 0 'quantity': 0
} }
] ]
@ -1720,7 +1720,7 @@ class TestVersion4(unittest.TestCase):
) )
) )
response = self.client.inventories({'site': 'https://retailcrm.ru'}) response = self.client.inventories({'site': 'https://retailcrm.pro'})
pook.off() pook.off()
self.assertTrue(response.is_successful(), True) self.assertTrue(response.is_successful(), True)
@ -1981,7 +1981,7 @@ class TestVersion4(unittest.TestCase):
'firstName': 'yyy', 'firstName': 'yyy',
'lastName': 'xxxx', 'lastName': 'xxxx',
'patronymic': 'www', 'patronymic': 'www',
'email': 'mail@retailcrm.ru', 'email': 'mail@retailcrm.pro',
'code': 'ccc7' 'code': 'ccc7'
}, },
'customer': { 'customer': {
@ -1990,7 +1990,7 @@ class TestVersion4(unittest.TestCase):
'firstName': 'ccc', 'firstName': 'ccc',
'lastName': 'zzz', 'lastName': 'zzz',
'patronymic': 'sss', 'patronymic': 'sss',
'email': 'mail@retailcrm.ru', 'email': 'mail@retailcrm.pro',
'code': 'ccc7', 'code': 'ccc7',
'phones': [{'number': '+71111111111'}] 'phones': [{'number': '+71111111111'}]
}, },
@ -2027,7 +2027,7 @@ class TestVersion4(unittest.TestCase):
{ {
'success': 'true', 'success': 'true',
'configuration': { 'configuration': {
'makeCallUrl': 'https://retailcrm.ru', 'makeCallUrl': 'https://retailcrm.pro',
'allowEdit': 'false', 'allowEdit': 'false',
'inputEventSupported': 'false', 'inputEventSupported': 'false',
'outputEventSupported': 'false', 'outputEventSupported': 'false',
@ -2056,7 +2056,7 @@ class TestVersion4(unittest.TestCase):
configuration = { configuration = {
'code': 'www', 'code': 'www',
'clientId': '5604', 'clientId': '5604',
'makeCallUrl': 'https://retailcrm.ru' 'makeCallUrl': 'https://retailcrm.pro'
} }
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v4/telephony/setting/' + configuration['code'] + '/edit') (pook.post(os.getenv('RETAILCRM_URL') + '/api/v4/telephony/setting/' + configuration['code'] + '/edit')
@ -2150,7 +2150,7 @@ class TestVersion4(unittest.TestCase):
'id': 777, 'id': 777,
'createdAt': '2020-04-05 11:23:46', 'createdAt': '2020-04-05 11:23:46',
'active': 'true', 'active': 'true',
'email': 'mail@retailcrm.ru', 'email': 'mail@retailcrm.pro',
'firstName': 'yyy', 'firstName': 'yyy',
'lastName': 'xxxx', 'lastName': 'xxxx',
'status': 'free', 'status': 'free',
@ -2189,7 +2189,7 @@ class TestVersion4(unittest.TestCase):
'id': 777, 'id': 777,
'createdAt': '2020-04-05 11:23:46', 'createdAt': '2020-04-05 11:23:46',
'active': 'true', 'active': 'true',
'email': 'mail@retailcrm.ru', 'email': 'mail@retailcrm.pro',
'firstName': 'yyy', 'firstName': 'yyy',
'lastName': 'xxxx', 'lastName': 'xxxx',
'status': 'free', 'status': 'free',

View File

@ -2,7 +2,7 @@
""" """
retailCRM API client v5 tests RetailCRM API client v5 tests
""" """
from urllib.parse import urlencode from urllib.parse import urlencode
@ -202,7 +202,7 @@ class TestVersion5(unittest.TestCase):
V5 Test wrong api url V5 Test wrong api url
""" """
(pook.get('https://epoqq.retailcrm.ru' + '/api/v5/statistic/update') (pook.get('https://epoqq.retailcrm.pro' + '/api/v5/statistic/update')
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')}) .headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
.reply(404) .reply(404)
.headers(self.__header) .headers(self.__header)
@ -214,7 +214,7 @@ class TestVersion5(unittest.TestCase):
) )
) )
client = retailcrm.v5('https://epoqq.retailcrm.ru', os.getenv('RETAILCRM_KEY')) client = retailcrm.v5('https://epoqq.retailcrm.pro', os.getenv('RETAILCRM_KEY'))
response = client.statistic_update() response = client.statistic_update()
pook.off() pook.off()
@ -4020,7 +4020,7 @@ class TestVersion5(unittest.TestCase):
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v5/store/inventories') (pook.get(os.getenv('RETAILCRM_URL') + '/api/v5/store/inventories')
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')}) .headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
.params({'filter[site]': 'https://retailcrm.ru'}) .params({'filter[site]': 'https://retailcrm.pro'})
.reply(200) .reply(200)
.headers(self.__header) .headers(self.__header)
.json( .json(
@ -4036,13 +4036,13 @@ class TestVersion5(unittest.TestCase):
{ {
'id': 33937, 'id': 33937,
'externalId': '89387', 'externalId': '89387',
'site': 'https://retailcrm.ru', 'site': 'https://retailcrm.pro',
'quantity': 102 'quantity': 102
}, },
{ {
'id': 33933, 'id': 33933,
'externalId': '46', 'externalId': '46',
'site': 'https://retailcrm.ru', 'site': 'https://retailcrm.pro',
'quantity': 0 'quantity': 0
} }
] ]
@ -4050,7 +4050,7 @@ class TestVersion5(unittest.TestCase):
) )
) )
response = self.client.inventories({'site': 'https://retailcrm.ru'}) response = self.client.inventories({'site': 'https://retailcrm.pro'})
pook.off() pook.off()
self.assertTrue(response.is_successful(), True) self.assertTrue(response.is_successful(), True)
@ -4477,7 +4477,7 @@ class TestVersion5(unittest.TestCase):
'firstName': 'John', 'firstName': 'John',
'lastName': 'Doe', 'lastName': 'Doe',
'patronymic': 'H.', 'patronymic': 'H.',
'email': 'mail@retailcrm.ru', 'email': 'mail@retailcrm.pro',
'code': 'ccc7' 'code': 'ccc7'
}, },
'customer': { 'customer': {
@ -4486,7 +4486,7 @@ class TestVersion5(unittest.TestCase):
'firstName': 'John', 'firstName': 'John',
'lastName': 'Doe', 'lastName': 'Doe',
'patronymic': 'H.', 'patronymic': 'H.',
'email': 'mail@retailcrm.ru', 'email': 'mail@retailcrm.pro',
'code': 'ccc7', 'code': 'ccc7',
'phones': [{'number': '+71111111111'}] 'phones': [{'number': '+71111111111'}]
}, },
@ -4583,7 +4583,7 @@ class TestVersion5(unittest.TestCase):
'id': 777, 'id': 777,
'createdAt': '2020-04-05 11:23:46', 'createdAt': '2020-04-05 11:23:46',
'active': 'true', 'active': 'true',
'email': 'mail@retailcrm.ru', 'email': 'mail@retailcrm.pro',
'firstName': 'yyy', 'firstName': 'yyy',
'lastName': 'xxxx', 'lastName': 'xxxx',
'status': 'free', 'status': 'free',
@ -4622,7 +4622,7 @@ class TestVersion5(unittest.TestCase):
'id': 777, 'id': 777,
'createdAt': '2020-04-05 11:23:46', 'createdAt': '2020-04-05 11:23:46',
'active': 'true', 'active': 'true',
'email': 'mail@retailcrm.ru', 'email': 'mail@retailcrm.pro',
'firstName': 'yyy', 'firstName': 'yyy',
'lastName': 'xxxx', 'lastName': 'xxxx',
'status': 'free', 'status': 'free',