====================== ** ============================== ** ============================================== ** ======================= Folder structure datasources __init__.py __init__.pyc lib libexec migrate modeler objects parsers resources skins tests thresholds zenpack.yaml ====================== ** ============================== ** ============================================== ** ======================= zenpack.yaml zProperties: MyProperties class_relationships: - Products.ZenModel.Device.Device 1:MC MyClass classes: DEFAULT: base: [zenpacklib.Component] MyClass: label: MyZenPack_MyClass plural_label: Qlik Sense Reload Tasks order: 4 properties: DEFAULTS: details_display: false OtgherProperties... MyZenPack: targetPythonClass: ZenPacks.My.Zenpack.MyZenpack_Mydatasources datasources: MyDatasources: type: Python plugin_classname: ZenPacks.My.Zenpack.datasources.MyDatasource.MyPlugin cycletime: "300" datapoints: MyDatapoints thresholds: MyThresholds graphs: MyGraphs ====================== ** ============================== ** ============================================== ** ======================= datasources/MyDataSource from twisted.internet import threads reactor.suggestThreadPoolSize(11) class MyDatasource(PythonDataSource): ZENPACKID = 'ZenPacks.My.Zenpack' # Friendly name for your data source type in the drop-down selection. sourcetypes = ('MyDatasource',) sourcetype = sourcetypes[0] # Collection plugin for this type. Defined below in this file. plugin_classname = 'MyPlugin' class MyPlugin(PythonDataSourcePlugin): @classmethod def config_key(cls, datasource, context): return ( context.device().id, datasource.getCycleTime(context), context.id, ) @classmethod def params(cls, datasource, context): return { 'deviceName': context.zABC, 'enums': context.MyEnums } def getResult(self): # HTTPS API Request d = requests.get(urr, headers=self.headers).text return(d) @inlineCallbacks response = yield threads.deferToThread(self.getResult) ====================== ** ============================== ** ============================================== ** =======================