dimo-python-sdk 0.0.4__tar.gz → 0.0.6__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 (32) hide show
  1. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/PKG-INFO +3 -2
  2. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/auth.py +5 -9
  3. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/environments.py +2 -0
  4. dimo_python_sdk-0.0.6/dimo/eth_signer.py +14 -0
  5. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo_python_sdk.egg-info/PKG-INFO +3 -2
  6. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo_python_sdk.egg-info/SOURCES.txt +1 -0
  7. dimo_python_sdk-0.0.6/dimo_python_sdk.egg-info/requires.txt +3 -0
  8. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/pyproject.toml +3 -2
  9. dimo_python_sdk-0.0.4/dimo_python_sdk.egg-info/requires.txt +0 -2
  10. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/LICENSE +0 -0
  11. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/README.md +0 -0
  12. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/__init__.py +0 -0
  13. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/__init__.py +0 -0
  14. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/device_data.py +0 -0
  15. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/device_definitions.py +0 -0
  16. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/devices.py +0 -0
  17. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/events.py +0 -0
  18. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/token_exchange.py +0 -0
  19. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/trips.py +0 -0
  20. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/user.py +0 -0
  21. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/valuations.py +0 -0
  22. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/api/vehicle_signal_decoding.py +0 -0
  23. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/constants.py +0 -0
  24. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/dimo.py +0 -0
  25. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/errors.py +0 -0
  26. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/graphql/__init__.py +0 -0
  27. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/graphql/identity.py +0 -0
  28. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/graphql/telemetry.py +0 -0
  29. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo/request.py +0 -0
  30. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo_python_sdk.egg-info/dependency_links.txt +0 -0
  31. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/dimo_python_sdk.egg-info/top_level.txt +0 -0
  32. {dimo_python_sdk-0.0.4 → dimo_python_sdk-0.0.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dimo-python-sdk
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: DIMO SDK in Python
5
5
  Author-email: Barrett Kowalsky <barrettkowalsky@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/DIMO-Network/dimo-python-sdk
@@ -13,7 +13,8 @@ Requires-Python: >=3.8
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
  Requires-Dist: requests>=2.30.0
16
- Requires-Dist: web3==6.20.0
16
+ Requires-Dist: eth_account==0.11.3
17
+ Requires-Dist: eth-utils==4.1.1
17
18
 
18
19
  # DIMO Python Developer SDK
19
20
 
@@ -1,6 +1,4 @@
1
- from web3 import Web3
2
- from eth_account.messages import encode_defunct
3
- from dimo.constants import dimo_constants
1
+ from dimo.eth_signer import EthSigner
4
2
  from dimo.errors import check_type, check_optional_type
5
3
  from urllib.parse import urlencode
6
4
  from typing import Dict, Optional
@@ -49,11 +47,7 @@ class Auth:
49
47
  check_type("message", message, str)
50
48
  check_type("private_key", private_key, str)
51
49
 
52
- web3 = Web3(Web3.HTTPProvider(dimo_constants[self.env]["RPC_provider"]))
53
- signed_message = web3.eth.account.sign_message(
54
- encode_defunct(text=message), private_key=private_key
55
- )
56
- return signed_message.signature.hex()
50
+ return EthSigner.sign_message(message, private_key)
57
51
 
58
52
  def submit_challenge(
59
53
  self,
@@ -81,11 +75,13 @@ class Auth:
81
75
  "grant_type": "authorization_code",
82
76
  }
83
77
 
78
+ encoded_data = urlencode(form_data)
79
+
84
80
  return self._request(
85
81
  "POST",
86
82
  "Auth",
87
83
  "/auth/web3/submit_challenge",
88
- data=form_data,
84
+ data=encoded_data,
89
85
  headers=headers,
90
86
  )
91
87
 
@@ -1,5 +1,6 @@
1
1
  dimo_environment = {
2
2
  "Production": {
3
+ "Attestation": "https://attestation-api.dimo.zone",
3
4
  "Auth": "https://auth.dimo.zone",
4
5
  "Identity": "https://identity-api.dimo.zone/query",
5
6
  "Devices": "https://devices-api.dimo.zone",
@@ -14,6 +15,7 @@ dimo_environment = {
14
15
  "VehicleSignalDecoding": "https://vehicle-signal-decoding.dimo.zone",
15
16
  },
16
17
  "Dev": {
18
+ "Attestation": "https://attestation-api.dev.dimo.zone",
17
19
  "Auth": "https://auth.dev.dimo.zone",
18
20
  "Identity": "https://identity-api.dev.dimo.zone/query",
19
21
  "Devices": "https://devices-api.dev.dimo.zone",
@@ -0,0 +1,14 @@
1
+ from eth_account import Account
2
+ from eth_account.messages import encode_defunct
3
+ from eth_utils import to_bytes, remove_0x_prefix, add_0x_prefix
4
+
5
+
6
+ class EthSigner:
7
+ @staticmethod
8
+ def sign_message(message: str, private_key: str) -> str:
9
+ private_key = add_0x_prefix(remove_0x_prefix(private_key))
10
+ message_hash = encode_defunct(text=message)
11
+ account = Account.from_key(private_key)
12
+ signed_message = account.sign_message(message_hash)
13
+
14
+ return add_0x_prefix(signed_message.signature.hex())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dimo-python-sdk
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: DIMO SDK in Python
5
5
  Author-email: Barrett Kowalsky <barrettkowalsky@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/DIMO-Network/dimo-python-sdk
@@ -13,7 +13,8 @@ Requires-Python: >=3.8
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
  Requires-Dist: requests>=2.30.0
16
- Requires-Dist: web3==6.20.0
16
+ Requires-Dist: eth_account==0.11.3
17
+ Requires-Dist: eth-utils==4.1.1
17
18
 
18
19
  # DIMO Python Developer SDK
19
20
 
@@ -6,6 +6,7 @@ dimo/constants.py
6
6
  dimo/dimo.py
7
7
  dimo/environments.py
8
8
  dimo/errors.py
9
+ dimo/eth_signer.py
9
10
  dimo/request.py
10
11
  dimo/api/__init__.py
11
12
  dimo/api/auth.py
@@ -0,0 +1,3 @@
1
+ requests>=2.30.0
2
+ eth_account==0.11.3
3
+ eth-utils==4.1.1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dimo-python-sdk"
7
- version = "0.0.4"
7
+ version = "0.0.6"
8
8
  authors = [
9
9
  { name="Barrett Kowalsky", email="barrettkowalsky@gmail.com" },
10
10
  ]
@@ -20,7 +20,8 @@ classifiers = [
20
20
 
21
21
  dependencies = [
22
22
  "requests>=2.30.0",
23
- "web3==6.20.0"
23
+ "eth_account==0.11.3",
24
+ "eth-utils==4.1.1",
24
25
  ]
25
26
 
26
27
  [project.urls]
@@ -1,2 +0,0 @@
1
- requests>=2.30.0
2
- web3==6.20.0
File without changes