dubidoc 0.1.2__tar.gz → 0.1.4__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.
Files changed (25) hide show
  1. {dubidoc-0.1.2 → dubidoc-0.1.4}/PKG-INFO +12 -3
  2. {dubidoc-0.1.2 → dubidoc-0.1.4}/README.md +11 -2
  3. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/__init__.py +1 -1
  4. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/client.py +21 -14
  5. dubidoc-0.1.4/dubidoc/response.py +4 -0
  6. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc.egg-info/PKG-INFO +12 -3
  7. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc.egg-info/SOURCES.txt +1 -0
  8. {dubidoc-0.1.2 → dubidoc-0.1.4}/pyproject.toml +1 -1
  9. {dubidoc-0.1.2 → dubidoc-0.1.4}/LICENSE +0 -0
  10. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/__init__.py +0 -0
  11. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/access_token.py +0 -0
  12. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/authentication.py +0 -0
  13. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/device.py +0 -0
  14. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/document.py +0 -0
  15. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/document_link.py +0 -0
  16. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/download.py +0 -0
  17. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/organization.py +0 -0
  18. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/organization_user.py +0 -0
  19. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/participant.py +0 -0
  20. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/_modules/storecode.py +0 -0
  21. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc/enum.py +0 -0
  22. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc.egg-info/dependency_links.txt +0 -0
  23. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc.egg-info/requires.txt +0 -0
  24. {dubidoc-0.1.2 → dubidoc-0.1.4}/dubidoc.egg-info/top_level.txt +0 -0
  25. {dubidoc-0.1.2 → dubidoc-0.1.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dubidoc
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Python SDK for dubidoc.com.ua API
5
5
  Maintainer-email: Dmytro Litvinov <me@dmytrolitvinov.com>
6
6
  License: MIT License
@@ -44,7 +44,7 @@ Requires-Dist: requests
44
44
 
45
45
  Python API wrapper around Dubidoc API. Feel free to contribute and make it better! 🚀
46
46
 
47
- **NOTE**: Since it is rearly release, some of the API endpoints may not be implemented yet. If you need some specific endpoint, feel free to create an issue or pull request.
47
+ **NOTE**: Since it is early release, some of the API endpoints may not be implemented yet. If you need some specific endpoint, feel free to create an issue or pull request.
48
48
  Also, library can be changed in the future, so be careful with the updates as for now.
49
49
 
50
50
  ## Installation
@@ -67,9 +67,18 @@ api_token = 'xxxxxxxxxxxxxxx'
67
67
  dubidoc = DubidocAPIClient(api_token)
68
68
 
69
69
  documents = dubidoc.document_api.list()
70
- print(documents)
70
+ print(documents.data, documents.response_code)
71
71
  ```
72
72
 
73
73
  ## License
74
74
 
75
75
  This project is licensed under the terms of the [MIT license](https://github.com/DmytroLitvinov/python-dubidoc/blob/master/LICENSE).
76
+
77
+
78
+ ### HOW TO MAKE A RELEASE
79
+
80
+ * Add changes to `CHANGELOG.md`
81
+ * Change version in `dubidoc/__init__.py` and `pyproject.toml`
82
+ * `source .env/bin/activate`
83
+ * `python3 -m build --sdist --wheel`
84
+ * `twine upload dist/*`
@@ -15,7 +15,7 @@
15
15
 
16
16
  Python API wrapper around Dubidoc API. Feel free to contribute and make it better! 🚀
17
17
 
18
- **NOTE**: Since it is rearly release, some of the API endpoints may not be implemented yet. If you need some specific endpoint, feel free to create an issue or pull request.
18
+ **NOTE**: Since it is early release, some of the API endpoints may not be implemented yet. If you need some specific endpoint, feel free to create an issue or pull request.
19
19
  Also, library can be changed in the future, so be careful with the updates as for now.
20
20
 
21
21
  ## Installation
@@ -38,9 +38,18 @@ api_token = 'xxxxxxxxxxxxxxx'
38
38
  dubidoc = DubidocAPIClient(api_token)
39
39
 
40
40
  documents = dubidoc.document_api.list()
41
- print(documents)
41
+ print(documents.data, documents.response_code)
42
42
  ```
43
43
 
44
44
  ## License
45
45
 
46
46
  This project is licensed under the terms of the [MIT license](https://github.com/DmytroLitvinov/python-dubidoc/blob/master/LICENSE).
47
+
48
+
49
+ ### HOW TO MAKE A RELEASE
50
+
51
+ * Add changes to `CHANGELOG.md`
52
+ * Change version in `dubidoc/__init__.py` and `pyproject.toml`
53
+ * `source .env/bin/activate`
54
+ * `python3 -m build --sdist --wheel`
55
+ * `twine upload dist/*`
@@ -2,6 +2,6 @@
2
2
 
3
3
  __author__ = 'Dmytro Litvinov'
4
4
  __email__ = 'me@dmytrolitvinov.com'
5
- __version__ = '0.1.2'
5
+ __version__ = '0.1.4'
6
6
 
7
7
  from .client import DubidocAPIClient
@@ -14,7 +14,7 @@ from dubidoc._modules import (
14
14
  DownloadAPI,
15
15
  )
16
16
  from dubidoc.enum import HttpMethod
17
-
17
+ from dubidoc.response import DubidocAPIResponse
18
18
 
19
19
  logger = logging.getLogger('dubidoc')
20
20
 
@@ -32,9 +32,9 @@ class DubidocAPIClient:
32
32
  'user-agent': f'python-dubidoc/{__version__} | (https://github.com/DmytroLitvinov/python-dubidoc)',
33
33
  }
34
34
 
35
- def __init__(self, api_token: str, environment: str = 'stage'):
35
+ def __init__(self, api_token: str, *, is_stage_env: bool = False):
36
36
  self.api_token = api_token
37
- if environment == 'stage':
37
+ if is_stage_env:
38
38
  self.base_url = 'https://docs-stage.navkolo.one'
39
39
  else:
40
40
  self.base_url = 'https://my.dubidoc.com.ua'
@@ -43,17 +43,19 @@ class DubidocAPIClient:
43
43
  self.prefix = f'api/api/{self.API_VERSION}/'
44
44
  self.endpoint = urljoin(self.base_url, self.prefix)
45
45
 
46
+ self._modules = {}
47
+
46
48
  # Modules
47
- self.document_api = DocumentAPI(self)
48
- self.document_link_api = DocumentLinkAPI(self)
49
- self.participant_api = ParticipantAPI(self)
50
- self.download_api = DownloadAPI(self)
49
+ self.document_api = self._get_module(DocumentAPI)
50
+ self.document_link_api = self._get_module(DocumentLinkAPI)
51
+ self.participant_api = self._get_module(ParticipantAPI)
52
+ self.download_api = self._get_module(DownloadAPI)
51
53
 
52
- if environment == 'stage':
53
- self.access_token_api = AccessTokenAPI(self)
54
- self.authentication_api = AuthenticationAPI(self)
55
- self.device_api = DeviceAPI(self)
56
- # Not yet implemented anot probably not needed
54
+ if is_stage_env == 'stage':
55
+ self.access_token_api = self._get_module(AccessTokenAPI)
56
+ self.authentication_api = self._get_module(AuthenticationAPI)
57
+ self.device_api = self._get_module(DeviceAPI)
58
+ # Not yet implemented and probably not needed
57
59
  # self.organization_user_api = OrganizationUserAPI(self)
58
60
  # self.organization_api = OrganizationAPI(self)
59
61
  # self.shortcode_api = ShortcodeAPI(self)
@@ -63,7 +65,12 @@ class DubidocAPIClient:
63
65
  headers.update({'X-Access-Token': f'{self.api_token}'})
64
66
  return headers
65
67
 
66
- def make_request(self, method: HttpMethod, path: str, body: dict = {}):
68
+ def _get_module(self, cls):
69
+ if cls not in self._modules:
70
+ self._modules[cls] = cls(self)
71
+ return self._modules[cls]
72
+
73
+ def make_request(self, method: HttpMethod, path: str, body: dict = {}) -> DubidocAPIResponse:
67
74
  """
68
75
  Fetches the given path in the Dubidoc API.
69
76
  :param method: HTTP method
@@ -79,4 +86,4 @@ class DubidocAPIClient:
79
86
  response = requests.request(method.value, url, headers=headers, json=body, timeout=10)
80
87
  logger.debug(f'Received response with status code {response.status_code} and body {response.text}')
81
88
 
82
- return response.json()
89
+ return DubidocAPIResponse(response.json(), response.status_code)
@@ -0,0 +1,4 @@
1
+ class DubidocAPIResponse:
2
+ def __init__(self, data, status_code):
3
+ self.data = data
4
+ self.status_code = status_code
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dubidoc
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Python SDK for dubidoc.com.ua API
5
5
  Maintainer-email: Dmytro Litvinov <me@dmytrolitvinov.com>
6
6
  License: MIT License
@@ -44,7 +44,7 @@ Requires-Dist: requests
44
44
 
45
45
  Python API wrapper around Dubidoc API. Feel free to contribute and make it better! 🚀
46
46
 
47
- **NOTE**: Since it is rearly release, some of the API endpoints may not be implemented yet. If you need some specific endpoint, feel free to create an issue or pull request.
47
+ **NOTE**: Since it is early release, some of the API endpoints may not be implemented yet. If you need some specific endpoint, feel free to create an issue or pull request.
48
48
  Also, library can be changed in the future, so be careful with the updates as for now.
49
49
 
50
50
  ## Installation
@@ -67,9 +67,18 @@ api_token = 'xxxxxxxxxxxxxxx'
67
67
  dubidoc = DubidocAPIClient(api_token)
68
68
 
69
69
  documents = dubidoc.document_api.list()
70
- print(documents)
70
+ print(documents.data, documents.response_code)
71
71
  ```
72
72
 
73
73
  ## License
74
74
 
75
75
  This project is licensed under the terms of the [MIT license](https://github.com/DmytroLitvinov/python-dubidoc/blob/master/LICENSE).
76
+
77
+
78
+ ### HOW TO MAKE A RELEASE
79
+
80
+ * Add changes to `CHANGELOG.md`
81
+ * Change version in `dubidoc/__init__.py` and `pyproject.toml`
82
+ * `source .env/bin/activate`
83
+ * `python3 -m build --sdist --wheel`
84
+ * `twine upload dist/*`
@@ -4,6 +4,7 @@ pyproject.toml
4
4
  dubidoc/__init__.py
5
5
  dubidoc/client.py
6
6
  dubidoc/enum.py
7
+ dubidoc/response.py
7
8
  dubidoc.egg-info/PKG-INFO
8
9
  dubidoc.egg-info/SOURCES.txt
9
10
  dubidoc.egg-info/dependency_links.txt
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dubidoc"
7
- version = "0.1.2"
7
+ version = "0.1.4"
8
8
  requires-python = ">=3.8"
9
9
  description = "Python SDK for dubidoc.com.ua API"
10
10
  readme = "README.md"
File without changes
File without changes
File without changes