pycupra 0.1.11__py3-2ndver-any.whl
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.
- pycupra/__init__.py +8 -0
- pycupra/__version__.py +6 -0
- pycupra/connection.py +1895 -0
- pycupra/const.py +195 -0
- pycupra/dashboard.py +1527 -0
- pycupra/exceptions.py +87 -0
- pycupra/firebase.py +90 -0
- pycupra/firebase_messaging/__init__.py +30 -0
- pycupra/firebase_messaging/android_checkin.proto +96 -0
- pycupra/firebase_messaging/android_checkin_pb2.py +36 -0
- pycupra/firebase_messaging/android_checkin_pb2.pyi +257 -0
- pycupra/firebase_messaging/checkin.proto +155 -0
- pycupra/firebase_messaging/checkin_pb2.py +31 -0
- pycupra/firebase_messaging/checkin_pb2.pyi +424 -0
- pycupra/firebase_messaging/const.py +32 -0
- pycupra/firebase_messaging/fcmpushclient.py +812 -0
- pycupra/firebase_messaging/fcmregister.py +519 -0
- pycupra/firebase_messaging/mcs.proto +328 -0
- pycupra/firebase_messaging/mcs_pb2.py +65 -0
- pycupra/firebase_messaging/mcs_pb2.pyi +1118 -0
- pycupra/firebase_messaging/py.typed +0 -0
- pycupra/utilities.py +116 -0
- pycupra/vehicle.py +3453 -0
- pycupra-0.1.11.dist-info/METADATA +13 -0
- pycupra-0.1.11.dist-info/RECORD +28 -0
- pycupra-0.1.11.dist-info/WHEEL +5 -0
- pycupra-0.1.11.dist-info/licenses/LICENSE +201 -0
- pycupra-0.1.11.dist-info/top_level.txt +1 -0
pycupra/exceptions.py
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
class SeatConfigException(Exception):
|
2
|
+
"""Raised when Seat Connect API client is configured incorrectly"""
|
3
|
+
|
4
|
+
def __init__(self, status):
|
5
|
+
"""Initialize exception"""
|
6
|
+
super(SeatConfigException, self).__init__(status)
|
7
|
+
self.status = status
|
8
|
+
|
9
|
+
class SeatAuthenticationException(Exception):
|
10
|
+
"""Raised when credentials are invalid during authentication"""
|
11
|
+
|
12
|
+
def __init__(self, status):
|
13
|
+
"""Initialize exception"""
|
14
|
+
super(SeatAuthenticationException, self).__init__(status)
|
15
|
+
self.status = status
|
16
|
+
|
17
|
+
class SeatAccountLockedException(Exception):
|
18
|
+
"""Raised when account is locked from too many login attempts"""
|
19
|
+
|
20
|
+
def __init__(self, status):
|
21
|
+
"""Initialize exception"""
|
22
|
+
super(SeatAccountLockedException, self).__init__(status)
|
23
|
+
self.status = status
|
24
|
+
|
25
|
+
class SeatTokenExpiredException(Exception):
|
26
|
+
"""Raised when server reports that the access token has expired"""
|
27
|
+
|
28
|
+
def __init__(self, status):
|
29
|
+
"""Initialize exception"""
|
30
|
+
super(SeatTokenExpiredException, self).__init__(status)
|
31
|
+
self.status = status
|
32
|
+
|
33
|
+
class SeatException(Exception):
|
34
|
+
"""Raised when an unknown error occurs during API interaction"""
|
35
|
+
|
36
|
+
def __init__(self, status):
|
37
|
+
"""Initialize exception"""
|
38
|
+
super(SeatException, self).__init__(status)
|
39
|
+
self.status = status
|
40
|
+
|
41
|
+
class SeatThrottledException(Exception):
|
42
|
+
"""Raised when the API throttles the connection"""
|
43
|
+
|
44
|
+
def __init__(self, status):
|
45
|
+
"""Initialize exception"""
|
46
|
+
super(SeatThrottledException, self).__init__(status)
|
47
|
+
self.status = status
|
48
|
+
|
49
|
+
class SeatEULAException(Exception):
|
50
|
+
"""Raised when EULA must be accepted before login"""
|
51
|
+
|
52
|
+
def __init__(self, status):
|
53
|
+
"""Initialize exception"""
|
54
|
+
super(SeatEULAException, self).__init__(status)
|
55
|
+
self.status = status
|
56
|
+
|
57
|
+
class SeatLoginFailedException(Exception):
|
58
|
+
"""Raised when login fails for an unknown reason"""
|
59
|
+
|
60
|
+
def __init__(self, status):
|
61
|
+
"""Initialize exception"""
|
62
|
+
super(SeatLoginFailedException, self).__init__(status)
|
63
|
+
self.status = status
|
64
|
+
|
65
|
+
class SeatInvalidRequestException(Exception):
|
66
|
+
"""Raised when an unsupported request is made"""
|
67
|
+
|
68
|
+
def __init__(self, status):
|
69
|
+
"""Initialize exception"""
|
70
|
+
super(SeatInvalidRequestException, self).__init__(status)
|
71
|
+
self.status = status
|
72
|
+
|
73
|
+
class SeatRequestInProgressException(Exception):
|
74
|
+
"""Raised when a request fails because another request is already in progress"""
|
75
|
+
|
76
|
+
def __init__(self, status):
|
77
|
+
"""Initialize exception"""
|
78
|
+
super(SeatRequestInProgressException, self).__init__(status)
|
79
|
+
self.status = status
|
80
|
+
|
81
|
+
class SeatServiceUnavailable(Exception):
|
82
|
+
"""Raised when a API is unavailable"""
|
83
|
+
|
84
|
+
def __init__(self, status):
|
85
|
+
"""Initialize exception"""
|
86
|
+
super(SeatServiceUnavailable, self).__init__(status)
|
87
|
+
self.status = status
|
pycupra/firebase.py
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
import logging
|
2
|
+
import asyncio
|
3
|
+
import os
|
4
|
+
import json
|
5
|
+
import string
|
6
|
+
import secrets
|
7
|
+
|
8
|
+
from .firebase_messaging import FcmPushClient, FcmRegisterConfig
|
9
|
+
|
10
|
+
from .const import (
|
11
|
+
FCM_PROJECT_ID,
|
12
|
+
FCM_API_KEY,
|
13
|
+
FCM_APP_ID
|
14
|
+
)
|
15
|
+
|
16
|
+
_LOGGER = logging.getLogger(__name__)
|
17
|
+
|
18
|
+
class Firebase():
|
19
|
+
def __init__(self):
|
20
|
+
self._pushClient = None
|
21
|
+
|
22
|
+
async def firebaseStart(self, onNotificationFunc, firebaseCredentialsFileName, brand='cupra'):
|
23
|
+
""" Starts the firebase cloud messaging receiver """
|
24
|
+
try:
|
25
|
+
loop = asyncio.get_running_loop()
|
26
|
+
credentials = await loop.run_in_executor(None, readFCMCredsFile, firebaseCredentialsFileName)
|
27
|
+
#credentials = readFCMCredsFile(firebaseCredentialsFileName)
|
28
|
+
if credentials == {}:
|
29
|
+
credentials =''
|
30
|
+
|
31
|
+
fcm_project_id=FCM_PROJECT_ID
|
32
|
+
fcm_app_id=FCM_APP_ID[brand]
|
33
|
+
fcm_api_key=FCM_API_KEY
|
34
|
+
chars = string.ascii_letters + string.digits
|
35
|
+
fcmMessageSenderId = ''.join(secrets.choice(chars) for i in range(16))
|
36
|
+
fcmMessageSenderId= 'fxpWQ_'+fcmMessageSenderId
|
37
|
+
|
38
|
+
fcm_config = FcmRegisterConfig(fcm_project_id, fcm_app_id, fcm_api_key, fcmMessageSenderId)
|
39
|
+
self._pushClient = FcmPushClient(onNotificationFunc, fcm_config, credentials, onFCMCredentialsUpdated)
|
40
|
+
fcm_token = await self._pushClient.checkin_or_register(firebaseCredentialsFileName)
|
41
|
+
_LOGGER.debug(f'Firebase.checkin_or_register() returned a token:{fcm_token}')
|
42
|
+
await self._pushClient.start()
|
43
|
+
await asyncio.sleep(5)
|
44
|
+
return self._pushClient.is_started()
|
45
|
+
except Exception as e:
|
46
|
+
_LOGGER.error(f'Error in firebaseStart. Error: {e}')
|
47
|
+
return False
|
48
|
+
|
49
|
+
async def firebaseStop(self):
|
50
|
+
""" Stops the firebase cloud messaging receiver """
|
51
|
+
try:
|
52
|
+
await self._pushClient.stop()
|
53
|
+
#await asyncio.sleep(5)
|
54
|
+
self._pushClient = None
|
55
|
+
return True
|
56
|
+
except Exception as e:
|
57
|
+
_LOGGER.error(f'Error in firebaseStop. Error: {e}')
|
58
|
+
return False
|
59
|
+
|
60
|
+
def readFCMCredsFile(credsFile):
|
61
|
+
""" Reads the firebase cloud messaging credentials from file"""
|
62
|
+
try:
|
63
|
+
if os.path.isfile(credsFile):
|
64
|
+
with open(credsFile, "r") as f:
|
65
|
+
credString=f.read()
|
66
|
+
f.close()
|
67
|
+
creds=json.loads(credString)
|
68
|
+
return creds
|
69
|
+
else:
|
70
|
+
_LOGGER.debug(f'{credsFile} not found.')
|
71
|
+
return {}
|
72
|
+
except Exception as e:
|
73
|
+
_LOGGER.warning(f'readFCMCredsFile() not successful. Error: {e}')
|
74
|
+
return ''
|
75
|
+
|
76
|
+
def writeFCMCredsFile(creds, firebaseCredentialsFileName):
|
77
|
+
""" Saves the firebase cloud messaging credentials to a file for future use """
|
78
|
+
try:
|
79
|
+
with open(firebaseCredentialsFileName, "w") as f:
|
80
|
+
f.write(json.dumps(creds))
|
81
|
+
f.close()
|
82
|
+
except Exception as e:
|
83
|
+
_LOGGER.warning(f'writeFCMCredsFile() not successful. Error: {e}')
|
84
|
+
|
85
|
+
async def onFCMCredentialsUpdated(creds, firebaseCredentialsFileName):
|
86
|
+
""" Is called from firebase-messaging package """
|
87
|
+
loop = asyncio.get_running_loop()
|
88
|
+
await loop.run_in_executor(None, writeFCMCredsFile, creds, firebaseCredentialsFileName)
|
89
|
+
#writeFCMCredsFile(creds, firebaseCredentialsFileName)
|
90
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
from .fcmpushclient import FcmPushClient, FcmPushClientConfig, FcmPushClientRunState
|
2
|
+
from .fcmregister import FcmRegisterConfig
|
3
|
+
from .mcs_pb2 import ( # pylint: disable=no-name-in-module
|
4
|
+
Close,
|
5
|
+
DataMessageStanza,
|
6
|
+
HeartbeatAck,
|
7
|
+
HeartbeatPing,
|
8
|
+
IqStanza,
|
9
|
+
LoginRequest,
|
10
|
+
LoginResponse,
|
11
|
+
SelectiveAck,
|
12
|
+
StreamErrorStanza,
|
13
|
+
)
|
14
|
+
|
15
|
+
from .android_checkin_pb2 import (
|
16
|
+
DEVICE_CHROME_BROWSER,
|
17
|
+
AndroidCheckinProto,
|
18
|
+
ChromeBuildProto,
|
19
|
+
)
|
20
|
+
from .checkin_pb2 import (
|
21
|
+
AndroidCheckinRequest,
|
22
|
+
AndroidCheckinResponse,
|
23
|
+
)
|
24
|
+
|
25
|
+
__all__ = [
|
26
|
+
"FcmPushClientConfig",
|
27
|
+
"FcmPushClient",
|
28
|
+
"FcmPushClientRunState",
|
29
|
+
"FcmRegisterConfig",
|
30
|
+
]
|
@@ -0,0 +1,96 @@
|
|
1
|
+
// Copyright 2014 The Chromium Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
//
|
5
|
+
// Logging information for Android "checkin" events (automatic, periodic
|
6
|
+
// requests made by Android devices to the server).
|
7
|
+
|
8
|
+
syntax = "proto2";
|
9
|
+
|
10
|
+
option optimize_for = LITE_RUNTIME;
|
11
|
+
package checkin_proto;
|
12
|
+
|
13
|
+
// Build characteristics unique to the Chrome browser, and Chrome OS
|
14
|
+
message ChromeBuildProto {
|
15
|
+
enum Platform {
|
16
|
+
PLATFORM_WIN = 1;
|
17
|
+
PLATFORM_MAC = 2;
|
18
|
+
PLATFORM_LINUX = 3;
|
19
|
+
PLATFORM_CROS = 4;
|
20
|
+
PLATFORM_IOS = 5;
|
21
|
+
// Just a placeholder. Likely don't need it due to the presence of the
|
22
|
+
// Android GCM on phone/tablet devices.
|
23
|
+
PLATFORM_ANDROID = 6;
|
24
|
+
}
|
25
|
+
|
26
|
+
enum Channel {
|
27
|
+
CHANNEL_STABLE = 1;
|
28
|
+
CHANNEL_BETA = 2;
|
29
|
+
CHANNEL_DEV = 3;
|
30
|
+
CHANNEL_CANARY = 4;
|
31
|
+
CHANNEL_UNKNOWN = 5; // for tip of tree or custom builds
|
32
|
+
}
|
33
|
+
|
34
|
+
// The platform of the device.
|
35
|
+
optional Platform platform = 1;
|
36
|
+
|
37
|
+
// The Chrome instance's version.
|
38
|
+
optional string chrome_version = 2;
|
39
|
+
|
40
|
+
// The Channel (build type) of Chrome.
|
41
|
+
optional Channel channel = 3;
|
42
|
+
}
|
43
|
+
|
44
|
+
// Information sent by the device in a "checkin" request.
|
45
|
+
message AndroidCheckinProto {
|
46
|
+
// Miliseconds since the Unix epoch of the device's last successful checkin.
|
47
|
+
optional int64 last_checkin_msec = 2;
|
48
|
+
|
49
|
+
// The current MCC+MNC of the mobile device's current cell.
|
50
|
+
optional string cell_operator = 6;
|
51
|
+
|
52
|
+
// The MCC+MNC of the SIM card (different from operator if the
|
53
|
+
// device is roaming, for instance).
|
54
|
+
optional string sim_operator = 7;
|
55
|
+
|
56
|
+
// The device's current roaming state (reported starting in eclair builds).
|
57
|
+
// Currently one of "{,not}mobile-{,not}roaming", if it is present at all.
|
58
|
+
optional string roaming = 8;
|
59
|
+
|
60
|
+
// For devices supporting multiple user profiles (which may be
|
61
|
+
// supported starting in jellybean), the ordinal number of the
|
62
|
+
// profile that is checking in. This is 0 for the primary profile
|
63
|
+
// (which can't be changed without wiping the device), and 1,2,3,...
|
64
|
+
// for additional profiles (which can be added and deleted freely).
|
65
|
+
optional int32 user_number = 9;
|
66
|
+
|
67
|
+
// Class of device. Indicates the type of build proto
|
68
|
+
// (IosBuildProto/ChromeBuildProto/AndroidBuildProto)
|
69
|
+
// That is included in this proto
|
70
|
+
optional DeviceType type = 12 [default = DEVICE_ANDROID_OS];
|
71
|
+
|
72
|
+
// For devices running MCS on Chrome, build-specific characteristics
|
73
|
+
// of the browser. There are no hardware aspects (except for ChromeOS).
|
74
|
+
// This will only be populated for Chrome builds/ChromeOS devices
|
75
|
+
optional checkin_proto.ChromeBuildProto chrome_build = 13;
|
76
|
+
|
77
|
+
// Note: Some of the Android specific optional fields were skipped to limit
|
78
|
+
// the protobuf definition.
|
79
|
+
// Next 14
|
80
|
+
}
|
81
|
+
|
82
|
+
// enum values correspond to the type of device.
|
83
|
+
// Used in the AndroidCheckinProto and Device proto.
|
84
|
+
enum DeviceType {
|
85
|
+
// Android Device
|
86
|
+
DEVICE_ANDROID_OS = 1;
|
87
|
+
|
88
|
+
// Apple IOS device
|
89
|
+
DEVICE_IOS_OS = 2;
|
90
|
+
|
91
|
+
// Chrome browser - Not Chrome OS. No hardware records.
|
92
|
+
DEVICE_CHROME_BROWSER = 3;
|
93
|
+
|
94
|
+
// Chrome OS
|
95
|
+
DEVICE_CHROME_OS = 4;
|
96
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: android_checkin.proto
|
4
|
+
"""Generated protocol buffer code."""
|
5
|
+
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
9
|
+
from google.protobuf.internal import builder as _builder
|
10
|
+
|
11
|
+
# @@protoc_insertion_point(imports)
|
12
|
+
|
13
|
+
_sym_db = _symbol_database.Default()
|
14
|
+
|
15
|
+
|
16
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
|
17
|
+
b'\n\x15\x61ndroid_checkin.proto\x12\rcheckin_proto"\x8a\x03\n\x10\x43hromeBuildProto\x12:\n\x08platform\x18\x01 \x01(\x0e\x32(.checkin_proto.ChromeBuildProto.Platform\x12\x16\n\x0e\x63hrome_version\x18\x02 \x01(\t\x12\x38\n\x07\x63hannel\x18\x03 \x01(\x0e\x32\'.checkin_proto.ChromeBuildProto.Channel"}\n\x08Platform\x12\x10\n\x0cPLATFORM_WIN\x10\x01\x12\x10\n\x0cPLATFORM_MAC\x10\x02\x12\x12\n\x0ePLATFORM_LINUX\x10\x03\x12\x11\n\rPLATFORM_CROS\x10\x04\x12\x10\n\x0cPLATFORM_IOS\x10\x05\x12\x14\n\x10PLATFORM_ANDROID\x10\x06"i\n\x07\x43hannel\x12\x12\n\x0e\x43HANNEL_STABLE\x10\x01\x12\x10\n\x0c\x43HANNEL_BETA\x10\x02\x12\x0f\n\x0b\x43HANNEL_DEV\x10\x03\x12\x12\n\x0e\x43HANNEL_CANARY\x10\x04\x12\x13\n\x0f\x43HANNEL_UNKNOWN\x10\x05"\xf6\x01\n\x13\x41ndroidCheckinProto\x12\x19\n\x11last_checkin_msec\x18\x02 \x01(\x03\x12\x15\n\rcell_operator\x18\x06 \x01(\t\x12\x14\n\x0csim_operator\x18\x07 \x01(\t\x12\x0f\n\x07roaming\x18\x08 \x01(\t\x12\x13\n\x0buser_number\x18\t \x01(\x05\x12:\n\x04type\x18\x0c \x01(\x0e\x32\x19.checkin_proto.DeviceType:\x11\x44\x45VICE_ANDROID_OS\x12\x35\n\x0c\x63hrome_build\x18\r \x01(\x0b\x32\x1f.checkin_proto.ChromeBuildProto*g\n\nDeviceType\x12\x15\n\x11\x44\x45VICE_ANDROID_OS\x10\x01\x12\x11\n\rDEVICE_IOS_OS\x10\x02\x12\x19\n\x15\x44\x45VICE_CHROME_BROWSER\x10\x03\x12\x14\n\x10\x44\x45VICE_CHROME_OS\x10\x04\x42\x02H\x03'
|
18
|
+
)
|
19
|
+
|
20
|
+
_globals = globals()
|
21
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
22
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "android_checkin_pb2", _globals)
|
23
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
24
|
+
_globals["DESCRIPTOR"]._options = None
|
25
|
+
_globals["DESCRIPTOR"]._serialized_options = b"H\003"
|
26
|
+
_globals["_DEVICETYPE"]._serialized_start = 686
|
27
|
+
_globals["_DEVICETYPE"]._serialized_end = 789
|
28
|
+
_globals["_CHROMEBUILDPROTO"]._serialized_start = 41
|
29
|
+
_globals["_CHROMEBUILDPROTO"]._serialized_end = 435
|
30
|
+
_globals["_CHROMEBUILDPROTO_PLATFORM"]._serialized_start = 203
|
31
|
+
_globals["_CHROMEBUILDPROTO_PLATFORM"]._serialized_end = 328
|
32
|
+
_globals["_CHROMEBUILDPROTO_CHANNEL"]._serialized_start = 330
|
33
|
+
_globals["_CHROMEBUILDPROTO_CHANNEL"]._serialized_end = 435
|
34
|
+
_globals["_ANDROIDCHECKINPROTO"]._serialized_start = 438
|
35
|
+
_globals["_ANDROIDCHECKINPROTO"]._serialized_end = 684
|
36
|
+
# @@protoc_insertion_point(module_scope)
|
@@ -0,0 +1,257 @@
|
|
1
|
+
"""
|
2
|
+
@generated by mypy-protobuf. Do not edit manually!
|
3
|
+
isort:skip_file
|
4
|
+
Copyright 2014 The Chromium Authors. All rights reserved.
|
5
|
+
Use of this source code is governed by a BSD-style license that can be
|
6
|
+
found in the LICENSE file.
|
7
|
+
|
8
|
+
Logging information for Android "checkin" events (automatic, periodic
|
9
|
+
requests made by Android devices to the server).
|
10
|
+
"""
|
11
|
+
|
12
|
+
import builtins
|
13
|
+
import google.protobuf.descriptor
|
14
|
+
import google.protobuf.internal.enum_type_wrapper
|
15
|
+
import google.protobuf.message
|
16
|
+
import sys
|
17
|
+
import typing
|
18
|
+
|
19
|
+
if sys.version_info >= (3, 10):
|
20
|
+
import typing as typing_extensions
|
21
|
+
else:
|
22
|
+
import typing_extensions
|
23
|
+
|
24
|
+
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
|
25
|
+
|
26
|
+
class _DeviceType:
|
27
|
+
ValueType = typing.NewType("ValueType", builtins.int)
|
28
|
+
V: typing_extensions.TypeAlias = ValueType
|
29
|
+
|
30
|
+
class _DeviceTypeEnumTypeWrapper(
|
31
|
+
google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_DeviceType.ValueType],
|
32
|
+
builtins.type,
|
33
|
+
):
|
34
|
+
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
|
35
|
+
DEVICE_ANDROID_OS: _DeviceType.ValueType # 1
|
36
|
+
"""Android Device"""
|
37
|
+
DEVICE_IOS_OS: _DeviceType.ValueType # 2
|
38
|
+
"""Apple IOS device"""
|
39
|
+
DEVICE_CHROME_BROWSER: _DeviceType.ValueType # 3
|
40
|
+
"""Chrome browser - Not Chrome OS. No hardware records."""
|
41
|
+
DEVICE_CHROME_OS: _DeviceType.ValueType # 4
|
42
|
+
"""Chrome OS"""
|
43
|
+
|
44
|
+
class DeviceType(_DeviceType, metaclass=_DeviceTypeEnumTypeWrapper):
|
45
|
+
"""enum values correspond to the type of device.
|
46
|
+
Used in the AndroidCheckinProto and Device proto.
|
47
|
+
"""
|
48
|
+
|
49
|
+
DEVICE_ANDROID_OS: DeviceType.ValueType # 1
|
50
|
+
"""Android Device"""
|
51
|
+
DEVICE_IOS_OS: DeviceType.ValueType # 2
|
52
|
+
"""Apple IOS device"""
|
53
|
+
DEVICE_CHROME_BROWSER: DeviceType.ValueType # 3
|
54
|
+
"""Chrome browser - Not Chrome OS. No hardware records."""
|
55
|
+
DEVICE_CHROME_OS: DeviceType.ValueType # 4
|
56
|
+
"""Chrome OS"""
|
57
|
+
global___DeviceType = DeviceType
|
58
|
+
|
59
|
+
@typing_extensions.final
|
60
|
+
class ChromeBuildProto(google.protobuf.message.Message):
|
61
|
+
"""Build characteristics unique to the Chrome browser, and Chrome OS"""
|
62
|
+
|
63
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
64
|
+
|
65
|
+
class _Platform:
|
66
|
+
ValueType = typing.NewType("ValueType", builtins.int)
|
67
|
+
V: typing_extensions.TypeAlias = ValueType
|
68
|
+
|
69
|
+
class _PlatformEnumTypeWrapper(
|
70
|
+
google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[
|
71
|
+
ChromeBuildProto._Platform.ValueType
|
72
|
+
],
|
73
|
+
builtins.type,
|
74
|
+
):
|
75
|
+
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
|
76
|
+
PLATFORM_WIN: ChromeBuildProto._Platform.ValueType # 1
|
77
|
+
PLATFORM_MAC: ChromeBuildProto._Platform.ValueType # 2
|
78
|
+
PLATFORM_LINUX: ChromeBuildProto._Platform.ValueType # 3
|
79
|
+
PLATFORM_CROS: ChromeBuildProto._Platform.ValueType # 4
|
80
|
+
PLATFORM_IOS: ChromeBuildProto._Platform.ValueType # 5
|
81
|
+
PLATFORM_ANDROID: ChromeBuildProto._Platform.ValueType # 6
|
82
|
+
"""Just a placeholder. Likely don't need it due to the presence of the
|
83
|
+
Android GCM on phone/tablet devices.
|
84
|
+
"""
|
85
|
+
|
86
|
+
class Platform(_Platform, metaclass=_PlatformEnumTypeWrapper): ...
|
87
|
+
PLATFORM_WIN: ChromeBuildProto.Platform.ValueType # 1
|
88
|
+
PLATFORM_MAC: ChromeBuildProto.Platform.ValueType # 2
|
89
|
+
PLATFORM_LINUX: ChromeBuildProto.Platform.ValueType # 3
|
90
|
+
PLATFORM_CROS: ChromeBuildProto.Platform.ValueType # 4
|
91
|
+
PLATFORM_IOS: ChromeBuildProto.Platform.ValueType # 5
|
92
|
+
PLATFORM_ANDROID: ChromeBuildProto.Platform.ValueType # 6
|
93
|
+
"""Just a placeholder. Likely don't need it due to the presence of the
|
94
|
+
Android GCM on phone/tablet devices.
|
95
|
+
"""
|
96
|
+
|
97
|
+
class _Channel:
|
98
|
+
ValueType = typing.NewType("ValueType", builtins.int)
|
99
|
+
V: typing_extensions.TypeAlias = ValueType
|
100
|
+
|
101
|
+
class _ChannelEnumTypeWrapper(
|
102
|
+
google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[
|
103
|
+
ChromeBuildProto._Channel.ValueType
|
104
|
+
],
|
105
|
+
builtins.type,
|
106
|
+
):
|
107
|
+
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
|
108
|
+
CHANNEL_STABLE: ChromeBuildProto._Channel.ValueType # 1
|
109
|
+
CHANNEL_BETA: ChromeBuildProto._Channel.ValueType # 2
|
110
|
+
CHANNEL_DEV: ChromeBuildProto._Channel.ValueType # 3
|
111
|
+
CHANNEL_CANARY: ChromeBuildProto._Channel.ValueType # 4
|
112
|
+
CHANNEL_UNKNOWN: ChromeBuildProto._Channel.ValueType # 5
|
113
|
+
"""for tip of tree or custom builds"""
|
114
|
+
|
115
|
+
class Channel(_Channel, metaclass=_ChannelEnumTypeWrapper): ...
|
116
|
+
CHANNEL_STABLE: ChromeBuildProto.Channel.ValueType # 1
|
117
|
+
CHANNEL_BETA: ChromeBuildProto.Channel.ValueType # 2
|
118
|
+
CHANNEL_DEV: ChromeBuildProto.Channel.ValueType # 3
|
119
|
+
CHANNEL_CANARY: ChromeBuildProto.Channel.ValueType # 4
|
120
|
+
CHANNEL_UNKNOWN: ChromeBuildProto.Channel.ValueType # 5
|
121
|
+
"""for tip of tree or custom builds"""
|
122
|
+
|
123
|
+
PLATFORM_FIELD_NUMBER: builtins.int
|
124
|
+
CHROME_VERSION_FIELD_NUMBER: builtins.int
|
125
|
+
CHANNEL_FIELD_NUMBER: builtins.int
|
126
|
+
platform: global___ChromeBuildProto.Platform.ValueType
|
127
|
+
"""The platform of the device."""
|
128
|
+
chrome_version: builtins.str
|
129
|
+
"""The Chrome instance's version."""
|
130
|
+
channel: global___ChromeBuildProto.Channel.ValueType
|
131
|
+
"""The Channel (build type) of Chrome."""
|
132
|
+
def __init__(
|
133
|
+
self,
|
134
|
+
*,
|
135
|
+
platform: global___ChromeBuildProto.Platform.ValueType | None = ...,
|
136
|
+
chrome_version: builtins.str | None = ...,
|
137
|
+
channel: global___ChromeBuildProto.Channel.ValueType | None = ...,
|
138
|
+
) -> None: ...
|
139
|
+
def HasField(
|
140
|
+
self,
|
141
|
+
field_name: typing_extensions.Literal[
|
142
|
+
"channel",
|
143
|
+
b"channel",
|
144
|
+
"chrome_version",
|
145
|
+
b"chrome_version",
|
146
|
+
"platform",
|
147
|
+
b"platform",
|
148
|
+
],
|
149
|
+
) -> builtins.bool: ...
|
150
|
+
def ClearField(
|
151
|
+
self,
|
152
|
+
field_name: typing_extensions.Literal[
|
153
|
+
"channel",
|
154
|
+
b"channel",
|
155
|
+
"chrome_version",
|
156
|
+
b"chrome_version",
|
157
|
+
"platform",
|
158
|
+
b"platform",
|
159
|
+
],
|
160
|
+
) -> None: ...
|
161
|
+
|
162
|
+
global___ChromeBuildProto = ChromeBuildProto
|
163
|
+
|
164
|
+
@typing_extensions.final
|
165
|
+
class AndroidCheckinProto(google.protobuf.message.Message):
|
166
|
+
"""Information sent by the device in a "checkin" request."""
|
167
|
+
|
168
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
169
|
+
|
170
|
+
LAST_CHECKIN_MSEC_FIELD_NUMBER: builtins.int
|
171
|
+
CELL_OPERATOR_FIELD_NUMBER: builtins.int
|
172
|
+
SIM_OPERATOR_FIELD_NUMBER: builtins.int
|
173
|
+
ROAMING_FIELD_NUMBER: builtins.int
|
174
|
+
USER_NUMBER_FIELD_NUMBER: builtins.int
|
175
|
+
TYPE_FIELD_NUMBER: builtins.int
|
176
|
+
CHROME_BUILD_FIELD_NUMBER: builtins.int
|
177
|
+
last_checkin_msec: builtins.int
|
178
|
+
"""Miliseconds since the Unix epoch of the device's last successful checkin."""
|
179
|
+
cell_operator: builtins.str
|
180
|
+
"""The current MCC+MNC of the mobile device's current cell."""
|
181
|
+
sim_operator: builtins.str
|
182
|
+
"""The MCC+MNC of the SIM card (different from operator if the
|
183
|
+
device is roaming, for instance).
|
184
|
+
"""
|
185
|
+
roaming: builtins.str
|
186
|
+
"""The device's current roaming state (reported starting in eclair builds).
|
187
|
+
Currently one of "{,not}mobile-{,not}roaming", if it is present at all.
|
188
|
+
"""
|
189
|
+
user_number: builtins.int
|
190
|
+
"""For devices supporting multiple user profiles (which may be
|
191
|
+
supported starting in jellybean), the ordinal number of the
|
192
|
+
profile that is checking in. This is 0 for the primary profile
|
193
|
+
(which can't be changed without wiping the device), and 1,2,3,...
|
194
|
+
for additional profiles (which can be added and deleted freely).
|
195
|
+
"""
|
196
|
+
type: global___DeviceType.ValueType
|
197
|
+
"""Class of device. Indicates the type of build proto
|
198
|
+
(IosBuildProto/ChromeBuildProto/AndroidBuildProto)
|
199
|
+
That is included in this proto
|
200
|
+
"""
|
201
|
+
@property
|
202
|
+
def chrome_build(self) -> global___ChromeBuildProto:
|
203
|
+
"""For devices running MCS on Chrome, build-specific characteristics
|
204
|
+
of the browser. There are no hardware aspects (except for ChromeOS).
|
205
|
+
This will only be populated for Chrome builds/ChromeOS devices
|
206
|
+
"""
|
207
|
+
def __init__(
|
208
|
+
self,
|
209
|
+
*,
|
210
|
+
last_checkin_msec: builtins.int | None = ...,
|
211
|
+
cell_operator: builtins.str | None = ...,
|
212
|
+
sim_operator: builtins.str | None = ...,
|
213
|
+
roaming: builtins.str | None = ...,
|
214
|
+
user_number: builtins.int | None = ...,
|
215
|
+
type: global___DeviceType.ValueType | None = ...,
|
216
|
+
chrome_build: global___ChromeBuildProto | None = ...,
|
217
|
+
) -> None: ...
|
218
|
+
def HasField(
|
219
|
+
self,
|
220
|
+
field_name: typing_extensions.Literal[
|
221
|
+
"cell_operator",
|
222
|
+
b"cell_operator",
|
223
|
+
"chrome_build",
|
224
|
+
b"chrome_build",
|
225
|
+
"last_checkin_msec",
|
226
|
+
b"last_checkin_msec",
|
227
|
+
"roaming",
|
228
|
+
b"roaming",
|
229
|
+
"sim_operator",
|
230
|
+
b"sim_operator",
|
231
|
+
"type",
|
232
|
+
b"type",
|
233
|
+
"user_number",
|
234
|
+
b"user_number",
|
235
|
+
],
|
236
|
+
) -> builtins.bool: ...
|
237
|
+
def ClearField(
|
238
|
+
self,
|
239
|
+
field_name: typing_extensions.Literal[
|
240
|
+
"cell_operator",
|
241
|
+
b"cell_operator",
|
242
|
+
"chrome_build",
|
243
|
+
b"chrome_build",
|
244
|
+
"last_checkin_msec",
|
245
|
+
b"last_checkin_msec",
|
246
|
+
"roaming",
|
247
|
+
b"roaming",
|
248
|
+
"sim_operator",
|
249
|
+
b"sim_operator",
|
250
|
+
"type",
|
251
|
+
b"type",
|
252
|
+
"user_number",
|
253
|
+
b"user_number",
|
254
|
+
],
|
255
|
+
) -> None: ...
|
256
|
+
|
257
|
+
global___AndroidCheckinProto = AndroidCheckinProto
|