dubidoc 0.1.0__tar.gz → 0.1.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.
Files changed (30) hide show
  1. {dubidoc-0.1.0 → dubidoc-0.1.1}/LICENSE +1 -1
  2. {dubidoc-0.1.0 → dubidoc-0.1.1}/PKG-INFO +5 -2
  3. {dubidoc-0.1.0 → dubidoc-0.1.1}/README.md +4 -1
  4. dubidoc-0.1.1/dubidoc/__init__.py +7 -0
  5. dubidoc-0.1.1/dubidoc/_modules/__init__.py +7 -0
  6. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc/_modules/access_token.py +4 -2
  7. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc/_modules/authentication.py +8 -11
  8. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc/_modules/device.py +4 -3
  9. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc/_modules/document.py +4 -4
  10. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc/_modules/document_link.py +3 -1
  11. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc/_modules/download.py +3 -1
  12. dubidoc-0.1.1/dubidoc/_modules/organization.py +1 -0
  13. dubidoc-0.1.1/dubidoc/_modules/organization_user.py +1 -0
  14. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc/_modules/participant.py +6 -2
  15. dubidoc-0.1.1/dubidoc/_modules/storecode.py +1 -0
  16. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc/client.py +22 -15
  17. dubidoc-0.1.1/dubidoc/enum.py +8 -0
  18. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc.egg-info/PKG-INFO +5 -2
  19. {dubidoc-0.1.0 → dubidoc-0.1.1}/pyproject.toml +5 -5
  20. dubidoc-0.1.0/dubidoc/__init__.py +0 -7
  21. dubidoc-0.1.0/dubidoc/_modules/__init__.py +0 -7
  22. dubidoc-0.1.0/dubidoc/_modules/organization.py +0 -1
  23. dubidoc-0.1.0/dubidoc/_modules/organization_user.py +0 -1
  24. dubidoc-0.1.0/dubidoc/_modules/storecode.py +0 -1
  25. dubidoc-0.1.0/dubidoc/enum.py +0 -8
  26. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc.egg-info/SOURCES.txt +0 -0
  27. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc.egg-info/dependency_links.txt +0 -0
  28. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc.egg-info/requires.txt +0 -0
  29. {dubidoc-0.1.0 → dubidoc-0.1.1}/dubidoc.egg-info/top_level.txt +0 -0
  30. {dubidoc-0.1.0 → dubidoc-0.1.1}/setup.cfg +0 -0
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dubidoc
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Python SDK for dubidoc.com.ua API
5
5
  Maintainer-email: Dmytro Litvinov <me@dmytrolitvinov.com>
6
6
  License: MIT License
7
7
  Project-URL: Homepage, https://github.com/DmytroLitvinov/python-dubidoc
8
8
  Project-URL: Issues, https://github.com/DmytroLitvinov/python-dubidoc/issues
9
- Project-URL: Changelog, https://github.com/DmytroLitvinov/python-dubidoc/CHANGELOG.md
9
+ Project-URL: Changelog, https://github.com/DmytroLitvinov/python-dubidoc/blob/main/CHANGELOG.md
10
10
  Keywords: dubidoc,Ukraine,🇺🇦,api,dubidoc.com.ua
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Environment :: Web Environment
@@ -44,6 +44,9 @@ 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.
48
+ Also, library can be changed in the future, so be careful with the updates as for now.
49
+
47
50
  ## Installation
48
51
 
49
52
  ```sh
@@ -15,6 +15,9 @@
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.
19
+ Also, library can be changed in the future, so be careful with the updates as for now.
20
+
18
21
  ## Installation
19
22
 
20
23
  ```sh
@@ -40,4 +43,4 @@ print(documents)
40
43
 
41
44
  ## License
42
45
 
43
- This project is licensed under the terms of the [MIT license](https://github.com/DmytroLitvinov/python-dubidoc/blob/master/LICENSE).
46
+ This project is licensed under the terms of the [MIT license](https://github.com/DmytroLitvinov/python-dubidoc/blob/master/LICENSE).
@@ -0,0 +1,7 @@
1
+ """Top-level package for Dubidoc API wrapper."""
2
+
3
+ __author__ = 'Dmytro Litvinov'
4
+ __email__ = 'me@dmytrolitvinov.com'
5
+ __version__ = '0.1.1'
6
+
7
+ from .client import DubidocAPIClient
@@ -0,0 +1,7 @@
1
+ from .access_token import *
2
+ from .authentication import *
3
+ from .device import *
4
+ from .document import *
5
+ from .document_link import *
6
+ from .download import *
7
+ from .participant import *
@@ -1,5 +1,7 @@
1
1
  from dubidoc.enum import HttpMethod
2
2
 
3
+ __all__ = ('AccessTokenAPI',)
4
+
3
5
 
4
6
  class AccessTokenAPI:
5
7
  PATH = 'access-tokens'
@@ -20,7 +22,7 @@ class AccessTokenAPI:
20
22
  :param title:
21
23
  """
22
24
  path = self.PATH
23
- return self.client.make_request(HttpMethod.POST, path, body={"title": title})
25
+ return self.client.make_request(HttpMethod.POST, path, body={'title': title})
24
26
 
25
27
  def revoke_token(self, token_id):
26
28
  """
@@ -28,4 +30,4 @@ class AccessTokenAPI:
28
30
  :param token_id:
29
31
  """
30
32
  path = f'{self.PATH}/{token_id}'
31
- return self.client.make_request(HttpMethod.DELETE, path)
33
+ return self.client.make_request(HttpMethod.DELETE, path)
@@ -1,8 +1,10 @@
1
1
  from dubidoc.enum import HttpMethod
2
2
 
3
3
 
4
- class AuthenticationAPI:
4
+ __all__ = ('AuthenticationAPI',)
5
+
5
6
 
7
+ class AuthenticationAPI:
6
8
  def __init__(self, client):
7
9
  self.client = client
8
10
 
@@ -12,7 +14,7 @@ class AuthenticationAPI:
12
14
  Description: Метод відправки тимчасового коду для авторизації через email
13
15
  """
14
16
  path = self.PATH
15
- body = {"login": login}
17
+ body = {'login': login}
16
18
  return self.client.make_request(HttpMethod.POST, path, body)
17
19
 
18
20
  def get_token(self, login, code):
@@ -21,10 +23,7 @@ class AuthenticationAPI:
21
23
  Description: Метод для отримання токену користувача на основі email та тимчасового коду авторизації
22
24
  """
23
25
  path = 'auth/get-token'
24
- body = {
25
- "login": login,
26
- "code": code
27
- }
26
+ body = {'login': login, 'code': code}
28
27
  return self.client.make_request(HttpMethod.POST, path, body)
29
28
 
30
29
  def refresh(self, refresh_token):
@@ -34,8 +33,6 @@ class AuthenticationAPI:
34
33
  :param token_id:
35
34
  :return:
36
35
  """
37
- path = f'token/refresh'
38
- body = {
39
- "refresh_token": refresh_token
40
- }
41
- return self.client.delete(HttpMethod.POST, path, body)
36
+ path = 'token/refresh'
37
+ body = {'refresh_token': refresh_token}
38
+ return self.client.delete(HttpMethod.POST, path, body)
@@ -1,8 +1,9 @@
1
1
  from dubidoc.enum import HttpMethod
2
2
 
3
+ __all__ = ('DeviceAPI',)
3
4
 
4
- class DeviceAPI:
5
5
 
6
+ class DeviceAPI:
6
7
  def __init__(self, client):
7
8
  self.client = client
8
9
 
@@ -12,7 +13,7 @@ class DeviceAPI:
12
13
  Description: Зареєструвати device token який отриманий через Firebase Cloud Messaging для відправки нотифікацій користувачу
13
14
  """
14
15
  path = 'devices'
15
- body = {"token": token}
16
+ body = {'token': token}
16
17
  return self.client.make_request(HttpMethod.POST, path, body)
17
18
 
18
19
  def unregister(self, token):
@@ -21,4 +22,4 @@ class DeviceAPI:
21
22
  Description: Скасувати відправку сповіщень для device token
22
23
  """
23
24
  path = f'devices/{token}'
24
- return self.client.make_request(HttpMethod.DELETE, path)
25
+ return self.client.make_request(HttpMethod.DELETE, path)
@@ -1,6 +1,9 @@
1
1
  from dubidoc.enum import HttpMethod
2
2
 
3
3
 
4
+ __all__ = ('DocumentAPI',)
5
+
6
+
4
7
  class DocumentAPI:
5
8
  PATH = 'documents'
6
9
 
@@ -17,11 +20,8 @@ class DocumentAPI:
17
20
  path = f'{self.PATH}/{document_id}'
18
21
  return self.client.make_request(HttpMethod.GET, path)
19
22
 
20
- def edit(self, document_id, title):
23
+ def edit(self, document_id, body):
21
24
  path = f'{self.PATH}/{document_id}'
22
- body = {
23
- "title": title,
24
- }
25
25
  return self.client.make_request(HttpMethod.PUT, path, body)
26
26
 
27
27
  def delete(self, document_id):
@@ -1,5 +1,7 @@
1
1
  from dubidoc.enum import HttpMethod
2
2
 
3
+ __all__ = ('DocumentLinkAPI',)
4
+
3
5
 
4
6
  class DocumentLinkAPI:
5
7
  PATH = 'documents/{}/links'
@@ -13,4 +15,4 @@ class DocumentLinkAPI:
13
15
 
14
16
  def revoke_public_link(self, document_id):
15
17
  path = self.PATH.format(document_id)
16
- return self.client.make_request(HttpMethod.DELETE, path)
18
+ return self.client.make_request(HttpMethod.DELETE, path)
@@ -1,6 +1,9 @@
1
1
  from dubidoc.enum import HttpMethod
2
2
 
3
3
 
4
+ __all__ = ('DownloadAPI',)
5
+
6
+
4
7
  class DownloadAPI:
5
8
  PATH = 'downloads'
6
9
 
@@ -18,4 +21,3 @@ class DownloadAPI:
18
21
  def check_status(self, download_id):
19
22
  path = f'{self.PATH}/{download_id}/status'
20
23
  return self.client.make_request(HttpMethod.GET, path)
21
-
@@ -0,0 +1 @@
1
+ # TODO
@@ -0,0 +1 @@
1
+ # TODO
@@ -1,8 +1,9 @@
1
1
  from dubidoc.enum import HttpMethod
2
2
 
3
+ __all__ = ('ParticipantAPI',)
3
4
 
4
- class ParticipantAPI:
5
5
 
6
+ class ParticipantAPI:
6
7
  def __init__(self, client):
7
8
  self.client = client
8
9
 
@@ -17,4 +18,7 @@ class ParticipantAPI:
17
18
  You can retrieve participant_id from the response of 'add_participant' method.
18
19
  """
19
20
  path = 'participants/{}'.format(participant_id)
20
- return self.client.make_request(HttpMethod.DELETE, path, )
21
+ return self.client.make_request(
22
+ HttpMethod.DELETE,
23
+ path,
24
+ )
@@ -0,0 +1 @@
1
+ # TODO
@@ -4,8 +4,15 @@ from urllib.parse import urljoin
4
4
  import requests
5
5
 
6
6
  from dubidoc import __version__
7
- from dubidoc._modules import AccessTokenAPI, AuthenticationAPI, DeviceAPI, DocumentAPI, DocumentLinkAPI, ParticipantAPI, \
8
- DownloadAPI
7
+ from dubidoc._modules import (
8
+ AccessTokenAPI,
9
+ AuthenticationAPI,
10
+ DeviceAPI,
11
+ DocumentAPI,
12
+ DocumentLinkAPI,
13
+ ParticipantAPI,
14
+ DownloadAPI,
15
+ )
9
16
  from dubidoc.enum import HttpMethod
10
17
 
11
18
 
@@ -18,22 +25,22 @@ class DubidocAPIClient:
18
25
  - https://docs-stage.navkolo.one/auth - staging URL
19
26
  """
20
27
 
21
- API_VERSION = "v1"
28
+ API_VERSION = 'v1'
22
29
  DEFAULT_HEADERS = {
23
- "accept": "application/json",
24
- "content-type": "application/json",
25
- "user-agent": f"python-dubidoc/{__version__} | (https://github.com/DmytroLitvinov/python-dubidoc)",
30
+ 'accept': 'application/json',
31
+ 'content-type': 'application/json',
32
+ 'user-agent': f'python-dubidoc/{__version__} | (https://github.com/DmytroLitvinov/python-dubidoc)',
26
33
  }
27
34
 
28
- def __init__(self, api_token: str, environment: str = "stage"):
35
+ def __init__(self, api_token: str, environment: str = 'stage'):
29
36
  self.api_token = api_token
30
- if environment == "stage":
31
- self.base_url = "https://docs-stage.navkolo.one"
37
+ if environment == 'stage':
38
+ self.base_url = 'https://docs-stage.navkolo.one'
32
39
  else:
33
- self.base_url = "https://my.dubidoc.com.ua"
40
+ self.base_url = 'https://my.dubidoc.com.ua'
34
41
  # FIXME: The prefix should be "api/v1" instead of "api/api/v1"
35
42
  # Dubidoc will notify when it will be fixed
36
- self.prefix = f"api/api/{self.API_VERSION}/"
43
+ self.prefix = f'api/api/{self.API_VERSION}/'
37
44
  self.endpoint = urljoin(self.base_url, self.prefix)
38
45
 
39
46
  # Modules
@@ -42,7 +49,7 @@ class DubidocAPIClient:
42
49
  self.participant_api = ParticipantAPI(self)
43
50
  self.download_api = DownloadAPI(self)
44
51
 
45
- if environment == "stage":
52
+ if environment == 'stage':
46
53
  self.access_token_api = AccessTokenAPI(self)
47
54
  self.authentication_api = AuthenticationAPI(self)
48
55
  self.device_api = DeviceAPI(self)
@@ -53,7 +60,7 @@ class DubidocAPIClient:
53
60
 
54
61
  def _get_headers(self):
55
62
  headers = self.DEFAULT_HEADERS.copy()
56
- headers.update({"X-Access-Token": f"{self.api_token}"})
63
+ headers.update({'X-Access-Token': f'{self.api_token}'})
57
64
  return headers
58
65
 
59
66
  def make_request(self, method: HttpMethod, path: str, body: dict = {}):
@@ -67,9 +74,9 @@ class DubidocAPIClient:
67
74
  url = urljoin(self.endpoint, path)
68
75
  headers = self._get_headers()
69
76
 
70
- logger.debug(f"Making {method.value} request to {url} with headers {headers} and body {body}")
77
+ logger.debug(f'Making {method.value} request to {url} with headers {headers} and body {body}')
71
78
  # https://github.com/psf/requests/issues/3070
72
79
  response = requests.request(method.value, url, headers=headers, json=body, timeout=10)
73
- logger.debug(f"Received response with status code {response.status_code} and body {response.text}")
80
+ logger.debug(f'Received response with status code {response.status_code} and body {response.text}')
74
81
 
75
82
  return response.json()
@@ -0,0 +1,8 @@
1
+ from enum import Enum
2
+
3
+
4
+ class HttpMethod(Enum):
5
+ GET = 'GET'
6
+ POST = 'POST'
7
+ PUT = 'PUT'
8
+ DELETE = 'DELETE'
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dubidoc
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Python SDK for dubidoc.com.ua API
5
5
  Maintainer-email: Dmytro Litvinov <me@dmytrolitvinov.com>
6
6
  License: MIT License
7
7
  Project-URL: Homepage, https://github.com/DmytroLitvinov/python-dubidoc
8
8
  Project-URL: Issues, https://github.com/DmytroLitvinov/python-dubidoc/issues
9
- Project-URL: Changelog, https://github.com/DmytroLitvinov/python-dubidoc/CHANGELOG.md
9
+ Project-URL: Changelog, https://github.com/DmytroLitvinov/python-dubidoc/blob/main/CHANGELOG.md
10
10
  Keywords: dubidoc,Ukraine,🇺🇦,api,dubidoc.com.ua
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Environment :: Web Environment
@@ -44,6 +44,9 @@ 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.
48
+ Also, library can be changed in the future, so be careful with the updates as for now.
49
+
47
50
  ## Installation
48
51
 
49
52
  ```sh
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dubidoc"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  requires-python = ">=3.8"
9
9
  description = "Python SDK for dubidoc.com.ua API"
10
10
  readme = "README.md"
@@ -36,10 +36,7 @@ dependencies = [
36
36
  [project.urls]
37
37
  Homepage = "https://github.com/DmytroLitvinov/python-dubidoc"
38
38
  Issues = "https://github.com/DmytroLitvinov/python-dubidoc/issues"
39
- Changelog = "https://github.com/DmytroLitvinov/python-dubidoc/CHANGELOG.md"
40
-
41
- [tool.setuptools.packages.find]
42
- include = ["dubidoc*"]
39
+ Changelog = "https://github.com/DmytroLitvinov/python-dubidoc/blob/main/CHANGELOG.md"
43
40
 
44
41
  # Ruff
45
42
  # ----
@@ -54,6 +51,9 @@ indent-style = "space"
54
51
  skip-magic-trailing-comma = false
55
52
  line-ending = "auto"
56
53
 
54
+ [tool.ruff.lint.per-file-ignores]
55
+ "__init__.py" = ["F401", "F403"]
56
+
57
57
  # Mypy
58
58
  # ----
59
59
 
@@ -1,7 +0,0 @@
1
- """Top-level package for Dubidoc API wrapper."""
2
-
3
- __author__ = "Dmytro Litvinov"
4
- __email__ = "me@dmytrolitvinov.com"
5
- __version__ = "0.1.0"
6
-
7
- from .client import DubidocAPIClient
@@ -1,7 +0,0 @@
1
- from .access_token import AccessTokenAPI
2
- from .authentication import AuthenticationAPI
3
- from .device import DeviceAPI
4
- from .document import DocumentAPI
5
- from .document_link import DocumentLinkAPI
6
- from .download import DownloadAPI
7
- from .participant import ParticipantAPI
@@ -1 +0,0 @@
1
- # TODO
@@ -1 +0,0 @@
1
- # TODO
@@ -1 +0,0 @@
1
- # TODO
@@ -1,8 +0,0 @@
1
- from enum import Enum
2
-
3
-
4
- class HttpMethod(Enum):
5
- GET = "GET"
6
- POST = "POST"
7
- PUT = "PUT"
8
- DELETE = "DELETE"
File without changes