Device Detection services for 51Degrees Pipeline

fiftyone_devicedetection_examples.example_utils.ExampleUtils Class Reference

Static Public Member Functions

 get_resource_key_from_config (config)
 set_resource_key_in_config (config, key)
 get_data_file_from_config (config)
 set_data_file_in_config (config, file)
 get_human_readable (device, property)
 Format a property value for display.
 get_profiles (hardware)
 Read the list of hardware profiles from the "hardware" element data.
 get_no_profiles_message ()
 The line printed when a lookup returned no device profiles at all.
 get_resource_key ()
 get_missing_resource_key_message ()
 The message shown when no resource key is set, naming the variable that was wanted rather than leaving the reader to guess.
 get_data_file_path ()
 get_cloud_endpoint ()
 find_file (file_name)
 get_data_file_date (engine)
 data_file_is_old (engine)
 get_data_file_tier (engine)
 check_data_file (pipeline, logger)

Static Public Attributes

int FIND_FILES_TIMEOUT_S = 5
int DATA_FILE_AGE_WARNING = 30
str RESOURCE_KEY_ENV_VAR = "_51DEGREES_RESOURCE_KEY"
str LEGACY_RESOURCE_KEY_ENV_VAR = "resource_key"
str ENDPOINT_ENV_VAR = "cloud_endpoint"
str DATA_FILE_ENV_VAR = "51DEGREES_DD_PATH"
 DATA_FOLDER = os.path.join("cxx", "data", "device-detection")
str DOWNLOAD_SOURCE = "examples-51degrees-python"

Member Function Documentation

◆ check_data_file()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.check_data_file ( pipeline,
logger )
static

◆ data_file_is_old()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.data_file_is_old ( engine)
static

◆ find_file()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.find_file ( file_name)
static

◆ get_cloud_endpoint()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_cloud_endpoint ( )
static

◆ get_data_file_date()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_data_file_date ( engine)
static

◆ get_data_file_from_config()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_data_file_from_config ( config)
static

◆ get_data_file_path()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_data_file_path ( )
static

◆ get_data_file_tier()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_data_file_tier ( engine)
static

◆ get_human_readable()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_human_readable ( device,
property )
static

Format a property value for display.

A property can be unavailable for three reasons, and each one reads differently so the person running the example can tell them apart. The property may have a value, it may have no value with the cloud service giving a reason (most often that the resource key is not entitled to it), or it may not be in the results at all.

◆ get_missing_resource_key_message()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_missing_resource_key_message ( )
static

The message shown when no resource key is set, naming the variable that was wanted rather than leaving the reader to guess.

◆ get_no_profiles_message()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_no_profiles_message ( )
static

The line printed when a lookup returned no device profiles at all.

◆ get_profiles()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_profiles ( hardware)
static

Read the list of hardware profiles from the "hardware" element data.

An empty list is returned when the resource key has no access to the hardware aspect at all, because reading a property that is not there raises rather than returning an empty list.

◆ get_resource_key()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_resource_key ( )
static

◆ get_resource_key_from_config()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.get_resource_key_from_config ( config)
static

◆ set_data_file_in_config()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.set_data_file_in_config ( config,
file )
static

◆ set_resource_key_in_config()

fiftyone_devicedetection_examples.example_utils.ExampleUtils.set_resource_key_in_config ( config,
key )
static

Member Data Documentation

◆ DATA_FILE_AGE_WARNING

int fiftyone_devicedetection_examples.example_utils.ExampleUtils.DATA_FILE_AGE_WARNING = 30
static

◆ DATA_FILE_ENV_VAR

str fiftyone_devicedetection_examples.example_utils.ExampleUtils.DATA_FILE_ENV_VAR = "51DEGREES_DD_PATH"
static

◆ DATA_FOLDER

fiftyone_devicedetection_examples.example_utils.ExampleUtils.DATA_FOLDER = os.path.join("cxx", "data", "device-detection")
static

◆ DOWNLOAD_SOURCE

str fiftyone_devicedetection_examples.example_utils.ExampleUtils.DOWNLOAD_SOURCE = "examples-51degrees-python"
static

◆ ENDPOINT_ENV_VAR

str fiftyone_devicedetection_examples.example_utils.ExampleUtils.ENDPOINT_ENV_VAR = "cloud_endpoint"
static

◆ FIND_FILES_TIMEOUT_S

int fiftyone_devicedetection_examples.example_utils.ExampleUtils.FIND_FILES_TIMEOUT_S = 5
static

◆ LEGACY_RESOURCE_KEY_ENV_VAR

str fiftyone_devicedetection_examples.example_utils.ExampleUtils.LEGACY_RESOURCE_KEY_ENV_VAR = "resource_key"
static

◆ RESOURCE_KEY_ENV_VAR

str fiftyone_devicedetection_examples.example_utils.ExampleUtils.RESOURCE_KEY_ENV_VAR = "_51DEGREES_RESOURCE_KEY"
static