def run(self, params={}):
     self.logger.info('GetNetworkDetails: Fetching network details ...')
     p = clear_empty_values(params)
     response = self.connection.call_api(
         'get', 'network/detail', params=p
     )
     return response
Esempio n. 2
0
    def run(self, params={}):
        self.logger.info("AddComment: Sending a comment to the server ...")

        params = {"netid": params.get("netid", ""), "comment": params.get("comment", "")}
        params = clear_empty_values(params)
        response = self.connection.call_api("post", "network/comment", data=params)
        return response
Esempio n. 3
0
    def run(self, params={}):
        self.logger.info("SearchNetworks: Sending a query to the server ...")
        p = clear_empty_values(params)
        response = self.connection.call_api("get", "network/search", params=p)

        return {
            k: response[k]
            for k in ("totalResults", "search_after", "first", "last",
                      "resultCount", "results") if k in response
        }
Esempio n. 4
0
    def run(self, params={}):
        self.logger.info('SearchNetworks: Sending a query to the server ...')
        p = clear_empty_values(params)
        response = self.connection.call_api('get', 'network/search', params=p)

        return {
            k: response[k]
            for k in ('totalResults', 'search_after', 'first', 'last',
                      'resultCount', 'results') if k in response
        }
Esempio n. 5
0
 def run(self, params={}):
     self.logger.info("GetUserTokens: Fetching tokens ...")
     params = clear_empty_values(params)
     token_type = params.get("type", None)
     response = self.connection.call_api("get",
                                         "profile/apiToken",
                                         params={"type": token_type})
     if isinstance(response, dict):
         return {"tokens": response["result"]}
     else:
         return {"tokens": []}
 def run(self, params={}):
     self.logger.info('GetUserTokens: Fetching tokens ...')
     params = clear_empty_values(params)
     token_type = params.get('type', None)
     response = self.connection.call_api('get',
                                         'profile/apiToken',
                                         params={'type': token_type})
     if isinstance(response, dict):
         return {'tokens': response['result']}
     else:
         return {'tokens': []}
Esempio n. 7
0
    def run(self, params={}):
        self.logger.info('AddComment: Sending a comment to the server ...')

        params = {
            'netid': params.get('netid', ''),
            'comment': params.get('comment', '')
        }
        params = clear_empty_values(params)
        response = self.connection.call_api('post',
                                            'network/comment',
                                            data=params)
        return response
Esempio n. 8
0
 def run(self, params={}):
     params = clear_empty_values(params)
     sort = params.get('sort', None)
     pagestart = params.get('pagestart', None)
     pageend = params.get('pageend', None)
     self.logger.info('GetUserStandings: Fetching user standings ...')
     response = self.connection.call_api('get',
                                         'stats/standings',
                                         params={
                                             'sort': sort,
                                             'pagestart': pagestart,
                                             'pageend': pageend
                                         })
     return response
Esempio n. 9
0
 def run(self, params={}):
     params = clear_empty_values(params)
     sort = params.get("sort", None)
     pagestart = params.get("pagestart", None)
     pageend = params.get("pageend", None)
     self.logger.info("GetUserStandings: Fetching user standings ...")
     response = self.connection.call_api(
         "get",
         "stats/standings",
         params={
             "sort": sort,
             "pagestart": pagestart,
             "pageend": pageend
         },
     )
     return response
 def run(self, params={}):
     self.logger.info(
         'GetMetadata: Getting cell network metadata from server ...')
     p = clear_empty_values(params)
     api_params = {'mcc': p.get('mcc', None), 'mnc': p.get('mnc', None)}
     response = self.connection.call_api('get',
                                         'cell/mccMnc',
                                         params=api_params)
     cell_network_metadata = []
     for mcc, mncs in response.items():
         cell_mcc = {'mcc': mcc}
         cell_mcc['cell_mncs'] = []
         for mnc, metadata in mncs.items():
             cell_mnc = {'mnc': mnc}
             cell_mnc['metadata'] = metadata
             cell_mcc['cell_mncs'].append(cell_mnc)
         cell_network_metadata.append(cell_mcc)
     return {'cell_network_metadata': cell_network_metadata}
Esempio n. 11
0
 def run(self, params={}):
     self.logger.info(
         "GetMetadata: Getting cell network metadata from server ...")
     p = clear_empty_values(params)
     api_params = {"mcc": p.get("mcc", None), "mnc": p.get("mnc", None)}
     response = self.connection.call_api("get",
                                         "cell/mccMnc",
                                         params=api_params)
     cell_network_metadata = []
     for mcc, mncs in response.items():
         cell_mcc = {"mcc": mcc}
         cell_mcc["cell_mncs"] = []
         for mnc, metadata in mncs.items():
             cell_mnc = {"mnc": mnc}
             cell_mnc["metadata"] = metadata
             cell_mcc["cell_mncs"].append(cell_mnc)
         cell_network_metadata.append(cell_mcc)
     return {"cell_network_metadata": cell_network_metadata}