kettles 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kettles-0.1/LICENSE +21 -0
- kettles-0.1/MANIFEST.in +3 -0
- kettles-0.1/PKG-INFO +61 -0
- kettles-0.1/README.md +5 -0
- kettles-0.1/dev.txt +13 -0
- kettles-0.1/kettles/__init__.py +0 -0
- kettles-0.1/kettles/adapters.py +22 -0
- kettles-0.1/kettles/api.py +93 -0
- kettles-0.1/kettles/exceptions.py +11 -0
- kettles-0.1/kettles/version_info.py +1 -0
- kettles-0.1/kettles.egg-info/PKG-INFO +61 -0
- kettles-0.1/kettles.egg-info/SOURCES.txt +16 -0
- kettles-0.1/kettles.egg-info/dependency_links.txt +1 -0
- kettles-0.1/kettles.egg-info/requires.txt +16 -0
- kettles-0.1/kettles.egg-info/top_level.txt +1 -0
- kettles-0.1/pyproject.toml +3 -0
- kettles-0.1/setup.cfg +4 -0
- kettles-0.1/setup.py +71 -0
kettles-0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cscshared
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
kettles-0.1/MANIFEST.in
ADDED
kettles-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kettles
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: kettles
|
|
5
|
+
Home-page: https://github.com/cscshared/kettles
|
|
6
|
+
Author: dev
|
|
7
|
+
Author-email: developers@directbuy.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: System Administrators
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: POSIX
|
|
15
|
+
Classifier: Operating System :: Unix
|
|
16
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Topic :: Software Development
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: deceit
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest; extra == "dev"
|
|
33
|
+
Requires-Dist: coverage; extra == "dev"
|
|
34
|
+
Requires-Dist: flake8; extra == "dev"
|
|
35
|
+
Requires-Dist: pylint; extra == "dev"
|
|
36
|
+
Requires-Dist: raft; extra == "dev"
|
|
37
|
+
Requires-Dist: twine; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest_aspec; extra == "dev"
|
|
39
|
+
Requires-Dist: ipython; extra == "dev"
|
|
40
|
+
Requires-Dist: bumpversion; extra == "dev"
|
|
41
|
+
Requires-Dist: convocations; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
43
|
+
Requires-Dist: waddle; extra == "dev"
|
|
44
|
+
Requires-Dist: build; extra == "dev"
|
|
45
|
+
Dynamic: author
|
|
46
|
+
Dynamic: author-email
|
|
47
|
+
Dynamic: classifier
|
|
48
|
+
Dynamic: description
|
|
49
|
+
Dynamic: description-content-type
|
|
50
|
+
Dynamic: home-page
|
|
51
|
+
Dynamic: license
|
|
52
|
+
Dynamic: license-file
|
|
53
|
+
Dynamic: provides-extra
|
|
54
|
+
Dynamic: requires-dist
|
|
55
|
+
Dynamic: summary
|
|
56
|
+
|
|
57
|
+
# kettles
|
|
58
|
+
|
|
59
|
+
a deceitful api wrapper for the kibo api
|
|
60
|
+
|
|
61
|
+
powered by angry penguins.
|
kettles-0.1/README.md
ADDED
kettles-0.1/dev.txt
ADDED
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from urllib3.util import Retry
|
|
2
|
+
from requests.adapters import DEFAULT_POOLSIZE, DEFAULT_POOLBLOCK
|
|
3
|
+
from deceit.adapters import RetryAdapter
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class KiboRetryAdapter(RetryAdapter):
|
|
7
|
+
def __init__(self, timeout=None, pool_connections=DEFAULT_POOLSIZE,
|
|
8
|
+
pool_maxsize=DEFAULT_POOLSIZE,
|
|
9
|
+
max_retries=None,
|
|
10
|
+
pool_block=DEFAULT_POOLBLOCK,
|
|
11
|
+
methods=None, statuses=None):
|
|
12
|
+
if not max_retries:
|
|
13
|
+
max_retries = Retry(
|
|
14
|
+
connect=5, read=5, redirect=4,
|
|
15
|
+
status_forcelist=statuses or [429, 502, 503, 504],
|
|
16
|
+
allowed_methods=methods or [
|
|
17
|
+
'HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE',
|
|
18
|
+
], backoff_factor=10, respect_retry_after_header=True)
|
|
19
|
+
super().__init__(
|
|
20
|
+
timeout=timeout, pool_connections=pool_connections,
|
|
21
|
+
pool_maxsize=pool_maxsize, max_retries=max_retries,
|
|
22
|
+
pool_block=pool_block, methods=methods, statuses=statuses)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import posixpath
|
|
2
|
+
from deceit.api_client import BackendOauth2Client
|
|
3
|
+
from .exceptions import KiboException
|
|
4
|
+
from .adapters import KiboRetryAdapter
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class KiboApi(BackendOauth2Client):
|
|
8
|
+
def __init__(self, *args, base_url=None, default_timeout=300,
|
|
9
|
+
exception_class=KiboException, token_url=None,
|
|
10
|
+
client_id=None, password=None, scopes=None,
|
|
11
|
+
tenant_id=None, site_id=None, correlation_id=None,
|
|
12
|
+
**kwargs):
|
|
13
|
+
if not token_url:
|
|
14
|
+
token_url = posixpath.join(base_url, 'api/platform/applications/authtickets/oauth')
|
|
15
|
+
super().__init__(
|
|
16
|
+
None, *args, base_url=base_url, default_timeout=default_timeout,
|
|
17
|
+
exception_class=exception_class, token_url=token_url,
|
|
18
|
+
client_id=client_id, password=password, scopes=scopes,
|
|
19
|
+
include_client_id=True, **kwargs)
|
|
20
|
+
self.tenant_id = tenant_id
|
|
21
|
+
self.site_id = site_id
|
|
22
|
+
self.correlation_id = correlation_id
|
|
23
|
+
self.adapter = KiboRetryAdapter(timeout=default_timeout)
|
|
24
|
+
self.session.mount('https://', self.adapter)
|
|
25
|
+
|
|
26
|
+
def headers(self, *args, **kwargs):
|
|
27
|
+
headers = super().headers()
|
|
28
|
+
headers['authorization'] = f'Bearer {self.session.access_token}'
|
|
29
|
+
headers['content-type'] = 'application/json'
|
|
30
|
+
headers['x-vol-tenant'] = self.tenant_id
|
|
31
|
+
if self.site_id:
|
|
32
|
+
headers['x-vol-site'] = self.site_id # pragma: nocover
|
|
33
|
+
if self.correlation_id:
|
|
34
|
+
headers['x-vol-correlation-id'] = self.correlation_id # pragma: nocover
|
|
35
|
+
return headers
|
|
36
|
+
|
|
37
|
+
def get_orders_page(self, page_size=None, start_index=None, odata_filter=None, raw=False, **kwargs):
|
|
38
|
+
"""
|
|
39
|
+
gets a single page of orders.
|
|
40
|
+
|
|
41
|
+
pass `raw`=`True` to get the raw response object instead of the parsed json.
|
|
42
|
+
max `pageSize` is 200
|
|
43
|
+
`startIndex` is 0-based
|
|
44
|
+
|
|
45
|
+
`odata_filter` is an OData filter string. For example, to get orders updated between June 5 and June 7, 2026:
|
|
46
|
+
```
|
|
47
|
+
auditInfo.updateDate ge 2026-06-05T00:00:00Z and auditInfo.updateDate lt 2026-06-07T00:00:00Z
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
docs for filtering examples: https://docs.kibocommerce.com/pages/sorting-and-filtering-apis
|
|
51
|
+
docs for orders api: https://docs.kibocommerce.com/api-reference/order/get-orders
|
|
52
|
+
"""
|
|
53
|
+
params = {}
|
|
54
|
+
if page_size:
|
|
55
|
+
params['pageSize'] = page_size
|
|
56
|
+
if start_index:
|
|
57
|
+
params['startIndex'] = start_index
|
|
58
|
+
if odata_filter:
|
|
59
|
+
params['filter'] = odata_filter
|
|
60
|
+
return self.get('api/commerce/orders', params=params, raw=raw, **kwargs)
|
|
61
|
+
|
|
62
|
+
def get_orders(self, odata_filter=None, page_size=200, **kwargs):
|
|
63
|
+
"""
|
|
64
|
+
gets all orders matching the filter by paging through results until there are no more.
|
|
65
|
+
|
|
66
|
+
`odata_filter` is an OData filter string.
|
|
67
|
+
For example, to get orders updated between June 5 and June 7, 2026:
|
|
68
|
+
```
|
|
69
|
+
auditInfo.updateDate ge 2026-06-05T00:00:00Z and auditInfo.updateDate lt 2026-06-07T00:00:00Z
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
docs for filtering examples: https://docs.kibocommerce.com/pages/sorting-and-filtering-apis
|
|
73
|
+
docs for orders api: https://docs.kibocommerce.com/api-reference/order/get-orders
|
|
74
|
+
"""
|
|
75
|
+
start_index = 0
|
|
76
|
+
all_results = []
|
|
77
|
+
total_pages = 1
|
|
78
|
+
n = 0
|
|
79
|
+
while n < total_pages:
|
|
80
|
+
result = self.get_orders_page(
|
|
81
|
+
page_size=page_size,
|
|
82
|
+
start_index=start_index,
|
|
83
|
+
odata_filter=odata_filter,
|
|
84
|
+
**kwargs,
|
|
85
|
+
)
|
|
86
|
+
items = result.get('items') or []
|
|
87
|
+
if not items:
|
|
88
|
+
break # pragma: nocover
|
|
89
|
+
all_results.extend(items)
|
|
90
|
+
start_index += page_size
|
|
91
|
+
total_pages = result['pageCount']
|
|
92
|
+
n += 1
|
|
93
|
+
return all_results
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from deceit.exceptions import ApiException
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class KiboException(ApiException):
|
|
5
|
+
def __init__(
|
|
6
|
+
self, status_code=None, content=None, text=None, data=None,
|
|
7
|
+
headers=None,
|
|
8
|
+
) -> None:
|
|
9
|
+
super().__init__(status_code, content, text, data, headers)
|
|
10
|
+
self.is_precondition_failed = status_code == 412
|
|
11
|
+
self.retryable = status_code == 429 or status_code == 412 or status_code >= 500
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
_version = '0.1'
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kettles
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: kettles
|
|
5
|
+
Home-page: https://github.com/cscshared/kettles
|
|
6
|
+
Author: dev
|
|
7
|
+
Author-email: developers@directbuy.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: System Administrators
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: POSIX
|
|
15
|
+
Classifier: Operating System :: Unix
|
|
16
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Topic :: Software Development
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: deceit
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest; extra == "dev"
|
|
33
|
+
Requires-Dist: coverage; extra == "dev"
|
|
34
|
+
Requires-Dist: flake8; extra == "dev"
|
|
35
|
+
Requires-Dist: pylint; extra == "dev"
|
|
36
|
+
Requires-Dist: raft; extra == "dev"
|
|
37
|
+
Requires-Dist: twine; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest_aspec; extra == "dev"
|
|
39
|
+
Requires-Dist: ipython; extra == "dev"
|
|
40
|
+
Requires-Dist: bumpversion; extra == "dev"
|
|
41
|
+
Requires-Dist: convocations; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
43
|
+
Requires-Dist: waddle; extra == "dev"
|
|
44
|
+
Requires-Dist: build; extra == "dev"
|
|
45
|
+
Dynamic: author
|
|
46
|
+
Dynamic: author-email
|
|
47
|
+
Dynamic: classifier
|
|
48
|
+
Dynamic: description
|
|
49
|
+
Dynamic: description-content-type
|
|
50
|
+
Dynamic: home-page
|
|
51
|
+
Dynamic: license
|
|
52
|
+
Dynamic: license-file
|
|
53
|
+
Dynamic: provides-extra
|
|
54
|
+
Dynamic: requires-dist
|
|
55
|
+
Dynamic: summary
|
|
56
|
+
|
|
57
|
+
# kettles
|
|
58
|
+
|
|
59
|
+
a deceitful api wrapper for the kibo api
|
|
60
|
+
|
|
61
|
+
powered by angry penguins.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
dev.txt
|
|
5
|
+
pyproject.toml
|
|
6
|
+
setup.py
|
|
7
|
+
kettles/__init__.py
|
|
8
|
+
kettles/adapters.py
|
|
9
|
+
kettles/api.py
|
|
10
|
+
kettles/exceptions.py
|
|
11
|
+
kettles/version_info.py
|
|
12
|
+
kettles.egg-info/PKG-INFO
|
|
13
|
+
kettles.egg-info/SOURCES.txt
|
|
14
|
+
kettles.egg-info/dependency_links.txt
|
|
15
|
+
kettles.egg-info/requires.txt
|
|
16
|
+
kettles.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
kettles
|
kettles-0.1/setup.cfg
ADDED
kettles-0.1/setup.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
from setuptools import setup
|
|
4
|
+
# from importlib.resources import open_text
|
|
5
|
+
# Version info -- read without importing
|
|
6
|
+
_locals = {}
|
|
7
|
+
|
|
8
|
+
# PyYAML ships a split Python 2/3 codebase. Unfortunately, some pip versions
|
|
9
|
+
# attempt to interpret both halves of PyYAML, yielding SyntaxErrors. Thus, we
|
|
10
|
+
# exclude whichever appears inappropriate for the installing interpreter.
|
|
11
|
+
exclude = ["*.yaml2", 'test']
|
|
12
|
+
|
|
13
|
+
# Frankenstein long_description: version-specific changelog note + README
|
|
14
|
+
with open('README.md') as f:
|
|
15
|
+
long_description = f.read()
|
|
16
|
+
|
|
17
|
+
extras = {}
|
|
18
|
+
all_extras = set()
|
|
19
|
+
for x in [ 'dev' ]:
|
|
20
|
+
filename = f'{x}.txt'
|
|
21
|
+
with open(filename, 'r') as f:
|
|
22
|
+
st = f.read()
|
|
23
|
+
rg = st.split()
|
|
24
|
+
extras[x] = rg
|
|
25
|
+
if x != 'dev':
|
|
26
|
+
all_extras |= set(rg)
|
|
27
|
+
if all_extras:
|
|
28
|
+
all_extras = list(all_extras)
|
|
29
|
+
all_extras.sort()
|
|
30
|
+
extras['all'] = all_extras
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
setup(
|
|
34
|
+
name='kettles',
|
|
35
|
+
version='0.1',
|
|
36
|
+
description='kettles',
|
|
37
|
+
license='MIT',
|
|
38
|
+
long_description=long_description,
|
|
39
|
+
long_description_content_type='text/markdown',
|
|
40
|
+
author='dev',
|
|
41
|
+
author_email='developers@directbuy.com',
|
|
42
|
+
url='https://github.com/cscshared/kettles',
|
|
43
|
+
packages=[
|
|
44
|
+
'kettles',
|
|
45
|
+
],
|
|
46
|
+
classifiers=[
|
|
47
|
+
'Development Status :: 5 - Production/Stable',
|
|
48
|
+
'Environment :: Console',
|
|
49
|
+
'Intended Audience :: Developers',
|
|
50
|
+
'Intended Audience :: System Administrators',
|
|
51
|
+
'License :: OSI Approved :: MIT License',
|
|
52
|
+
'Operating System :: POSIX',
|
|
53
|
+
'Operating System :: Unix',
|
|
54
|
+
'Operating System :: MacOS :: MacOS X',
|
|
55
|
+
'Operating System :: Microsoft :: Windows',
|
|
56
|
+
'Programming Language :: Python',
|
|
57
|
+
'Programming Language :: Python :: 3',
|
|
58
|
+
'Programming Language :: Python :: 3.6',
|
|
59
|
+
'Programming Language :: Python :: 3.7',
|
|
60
|
+
'Programming Language :: Python :: 3.8',
|
|
61
|
+
'Programming Language :: Python :: 3.9',
|
|
62
|
+
'Programming Language :: Python :: 3.10',
|
|
63
|
+
'Topic :: Software Development',
|
|
64
|
+
'Topic :: Software Development :: Libraries',
|
|
65
|
+
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
66
|
+
],
|
|
67
|
+
install_requires=[
|
|
68
|
+
'deceit',
|
|
69
|
+
],
|
|
70
|
+
extras_require=extras,
|
|
71
|
+
)
|