This example shows how to use the 51Degrees Cloud service to lookup
the details of a device based on a given 'TAC'.
More background information on TACs can be found through various online
sources such as Wikipedia.
1 This example shows the details of devices associated
with a given
'Type Allocation Code' or 'TAC'.
2 More background information on TACs can be found through various online sources such
as Wikipedia: https://en.wikipedia.org/wiki/Type_Allocation_Code
3 ----------------------------------------
4 Which devices are associated
with the tac: 35925406
5 Apple [
'iPhone 6'] A1586
40 from fiftyone_pipeline_core.pipelinebuilder
import PipelineBuilder
41 from fiftyone_pipeline_cloudrequestengine.cloudrequestengine
import CloudRequestEngine
42 from fiftyone_devicedetection.hardwareprofile_cloud
import HardwareProfileCloud
47 resourceKey =
"!!YOUR_RESOURCE_KEY!!" 49 if resourceKey ==
"!!YOUR_RESOURCE_KEY!!":
51 You need to create a resource key at 52 https://configure.51degrees.com and paste it into the code, 53 'replacing !!YOUR_RESOURCE_KEY!! 54 make sure to include the HardwareName, HardwareProfile and HardwareVendor 55 properties used by this example 61 requestEngineInstance = CloudRequestEngine({
62 "resourceKey": resourceKey
67 hardwareProfileEngineInstance = HardwareProfileCloud()
72 pipeline = PipelineBuilder().add(requestEngineInstance).add(hardwareProfileEngineInstance).build()
79 flowData = pipeline.create_flowdata()
82 flowData.evidence.add(
'query.tac', tac)
93 print(
"Which devices are associated with the tac: " + tac)
95 for profile
in flowData.hardware.profiles:
96 hardwareVendor = profile[
"hardwarevendor"]
97 hardwareName = profile[
"hardwarename"]
98 hardwareModel = profile[
"hardwaremodel"]
100 if (hardwareVendor.has_value
and hardwareName.has_value
and hardwareModel.has_value):
101 print(hardwareVendor.value() +
" " + str(hardwareName.value()) +
" "+ hardwareModel.value())
103 print(hardwareVendor.no_value_message())