pycloudedge 0.1.3__tar.gz → 0.1.4.dev1__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.
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/PKG-INFO +1 -1
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/cloudedge/_version.py +3 -3
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/cloudedge/client.py +17 -5
- pycloudedge-0.1.4.dev1/cloudedge/constants.py +68 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/pycloudedge.egg-info/PKG-INFO +1 -1
- pycloudedge-0.1.3/cloudedge/constants.py +0 -33
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/.env.example +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/.gitignore +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/LICENSE +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/MANIFEST.in +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/README.md +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/cloudedge/__init__.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/cloudedge/cli.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/cloudedge/exceptions.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/cloudedge/iot_parameters.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/cloudedge/logging_config.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/cloudedge/utils.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/cloudedge/validators.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/examples/README.md +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/examples/basic_example.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/examples/device_control.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/examples/network_ping_status.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/pycloudedge.egg-info/SOURCES.txt +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/pycloudedge.egg-info/dependency_links.txt +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/pycloudedge.egg-info/entry_points.txt +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/pycloudedge.egg-info/requires.txt +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/pycloudedge.egg-info/top_level.txt +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/pyproject.toml +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/requirements-dev.txt +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/requirements.txt +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/setup.cfg +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/setup.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/tests/test_basic.py +0 -0
- {pycloudedge-0.1.3 → pycloudedge-0.1.4.dev1}/tests/test_improvements.py +0 -0
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.1.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 1,
|
|
31
|
+
__version__ = version = '0.1.4.dev1'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 4, 'dev1')
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'gbd742badc'
|
|
@@ -35,7 +35,11 @@ from .iot_parameters import (
|
|
|
35
35
|
get_parameter_code_by_name,
|
|
36
36
|
format_parameter_value
|
|
37
37
|
)
|
|
38
|
-
from .constants import
|
|
38
|
+
from .constants import (
|
|
39
|
+
CA_KEY, DEFAULT_HEADERS, DEFAULT_TIMEOUT,
|
|
40
|
+
REGION_ENDPOINTS, REGION_EU, REGION_US,
|
|
41
|
+
region_for_country,
|
|
42
|
+
)
|
|
39
43
|
from .validators import validate_email, validate_country_code, validate_phone_code
|
|
40
44
|
from .logging_config import get_logger
|
|
41
45
|
from .utils import retry_on_failure
|
|
@@ -64,9 +68,6 @@ class CloudEdgeClient:
|
|
|
64
68
|
... print(f"Device: {device['name']} - Status: {device['online']}")
|
|
65
69
|
"""
|
|
66
70
|
|
|
67
|
-
BASE_URL = "https://apis-eu-frankfurt.cloudedge360.com"
|
|
68
|
-
OPENAPI_BASE_URL = "https://openapi-euce.mearicloud.com"
|
|
69
|
-
|
|
70
71
|
def __init__(
|
|
71
72
|
self,
|
|
72
73
|
username: str,
|
|
@@ -76,7 +77,8 @@ class CloudEdgeClient:
|
|
|
76
77
|
debug: bool = False,
|
|
77
78
|
session_cache_file: str = ".cloudedge_session_cache",
|
|
78
79
|
enable_network_ping: bool = True,
|
|
79
|
-
ping_timeout: float = 2.0
|
|
80
|
+
ping_timeout: float = 2.0,
|
|
81
|
+
region: Optional[str] = None,
|
|
80
82
|
):
|
|
81
83
|
"""
|
|
82
84
|
Initialize CloudEdge API client.
|
|
@@ -90,6 +92,9 @@ class CloudEdgeClient:
|
|
|
90
92
|
session_cache_file (str): Path to session cache file
|
|
91
93
|
enable_network_ping (bool): Enable ping-based online status when on same network
|
|
92
94
|
ping_timeout (float): Ping timeout in seconds
|
|
95
|
+
region (str, optional): Force a specific region ("eu" or "us").
|
|
96
|
+
When *None* the region is derived automatically from *country_code*:
|
|
97
|
+
European countries use the EU endpoints, everything else uses US.
|
|
93
98
|
|
|
94
99
|
Raises:
|
|
95
100
|
ValidationError: If input validation fails
|
|
@@ -118,6 +123,13 @@ class CloudEdgeClient:
|
|
|
118
123
|
self.country_code = country_code.upper()
|
|
119
124
|
self.phone_code = phone_code if phone_code.startswith('+') else f'+{phone_code}'
|
|
120
125
|
|
|
126
|
+
# Resolve region and endpoints
|
|
127
|
+
resolved_region = region if region in REGION_ENDPOINTS else region_for_country(self.country_code)
|
|
128
|
+
endpoints = REGION_ENDPOINTS[resolved_region]
|
|
129
|
+
self.region = resolved_region
|
|
130
|
+
self.BASE_URL = endpoints["base_url"]
|
|
131
|
+
self.OPENAPI_BASE_URL = endpoints["openapi_base_url"]
|
|
132
|
+
|
|
121
133
|
# Setup proper logging
|
|
122
134
|
self.logger = get_logger("client")
|
|
123
135
|
if debug:
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Configuration constants for CloudEdge API
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Region identifiers
|
|
6
|
+
REGION_EU = "eu"
|
|
7
|
+
REGION_US = "us"
|
|
8
|
+
|
|
9
|
+
# Per-region API endpoints
|
|
10
|
+
REGION_ENDPOINTS = {
|
|
11
|
+
REGION_EU: {
|
|
12
|
+
"base_url": "https://apis-eu-frankfurt.cloudedge360.com",
|
|
13
|
+
"openapi_base_url": "https://openapi-euce.mearicloud.com",
|
|
14
|
+
},
|
|
15
|
+
REGION_US: {
|
|
16
|
+
"base_url": "https://apis-us-west.cloudedge360.com",
|
|
17
|
+
"openapi_base_url": "https://openapi-uswe.mearicloud.com",
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# Default endpoints (EU) – kept for backward compatibility
|
|
22
|
+
BASE_URL = REGION_ENDPOINTS[REGION_EU]["base_url"]
|
|
23
|
+
OPENAPI_BASE_URL = REGION_ENDPOINTS[REGION_EU]["openapi_base_url"]
|
|
24
|
+
|
|
25
|
+
# European country codes (ISO 3166-1 alpha-2)
|
|
26
|
+
EU_COUNTRY_CODES = {
|
|
27
|
+
"AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR",
|
|
28
|
+
"DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL",
|
|
29
|
+
"PL", "PT", "RO", "SK", "SI", "ES", "SE",
|
|
30
|
+
# EEA + EFTA + UK
|
|
31
|
+
"IS", "LI", "NO", "CH", "GB",
|
|
32
|
+
# Other European countries
|
|
33
|
+
"AL", "AD", "AM", "AZ", "BA", "BY", "GE", "GI", "XK", "MD",
|
|
34
|
+
"MC", "ME", "MK", "RS", "RU", "SM", "TR", "UA", "VA",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def region_for_country(country_code: str) -> str:
|
|
39
|
+
"""Return the region key for a given ISO 3166-1 alpha-2 country code."""
|
|
40
|
+
if country_code.upper() in EU_COUNTRY_CODES:
|
|
41
|
+
return REGION_EU
|
|
42
|
+
return REGION_US
|
|
43
|
+
|
|
44
|
+
# API Keys (these are public keys from the mobile app)
|
|
45
|
+
CA_KEY = "bc29be30292a4309877807e101afbd51"
|
|
46
|
+
|
|
47
|
+
# Default Headers
|
|
48
|
+
DEFAULT_HEADERS = {
|
|
49
|
+
"Accept-Language": "en-US,en;q=0.8",
|
|
50
|
+
"User-Agent": "Mozilla/5.0 (Linux; U; Android 10; en-us; Android SDK built for arm64 Build/QSR1.211112.002) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 Mobile Safari/533.1",
|
|
51
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
52
|
+
"Accept-Encoding": "gzip, deflate, br"
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# API Constants
|
|
56
|
+
PHONE_TYPE = "a"
|
|
57
|
+
SOURCE_APP = "8"
|
|
58
|
+
APP_VERSION = "5.5.1"
|
|
59
|
+
IOT_TYPE = "4"
|
|
60
|
+
APP_VERSION_CODE = "551"
|
|
61
|
+
DEFAULT_LANGUAGE = "en"
|
|
62
|
+
|
|
63
|
+
# Timeout values (seconds)
|
|
64
|
+
DEFAULT_TIMEOUT = 30
|
|
65
|
+
PING_TIMEOUT = 2.0
|
|
66
|
+
|
|
67
|
+
# Cache settings
|
|
68
|
+
DEFAULT_CACHE_FILE = ".cloudedge_session_cache"
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Configuration constants for CloudEdge API
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
# API Endpoints
|
|
6
|
-
BASE_URL = "https://apis-eu-frankfurt.cloudedge360.com"
|
|
7
|
-
OPENAPI_BASE_URL = "https://openapi-euce.mearicloud.com"
|
|
8
|
-
|
|
9
|
-
# API Keys (these are public keys from the mobile app)
|
|
10
|
-
CA_KEY = "bc29be30292a4309877807e101afbd51"
|
|
11
|
-
|
|
12
|
-
# Default Headers
|
|
13
|
-
DEFAULT_HEADERS = {
|
|
14
|
-
"Accept-Language": "en-US,en;q=0.8",
|
|
15
|
-
"User-Agent": "Mozilla/5.0 (Linux; U; Android 10; en-us; Android SDK built for arm64 Build/QSR1.211112.002) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 Mobile Safari/533.1",
|
|
16
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
17
|
-
"Accept-Encoding": "gzip, deflate, br"
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
# API Constants
|
|
21
|
-
PHONE_TYPE = "a"
|
|
22
|
-
SOURCE_APP = "8"
|
|
23
|
-
APP_VERSION = "5.5.1"
|
|
24
|
-
IOT_TYPE = "4"
|
|
25
|
-
APP_VERSION_CODE = "551"
|
|
26
|
-
DEFAULT_LANGUAGE = "en"
|
|
27
|
-
|
|
28
|
-
# Timeout values (seconds)
|
|
29
|
-
DEFAULT_TIMEOUT = 30
|
|
30
|
-
PING_TIMEOUT = 2.0
|
|
31
|
-
|
|
32
|
-
# Cache settings
|
|
33
|
-
DEFAULT_CACHE_FILE = ".cloudedge_session_cache"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|