Exemplo n.º 1
0
    def file_download(self, file_name, destination, download_async='true'):
        """
        Download file from DxChain Network
        :param file_name: file you are trying to download from DxChain Network
        :param destination: absolute path, where to place downloaded file
        :param download_async: download file in async way
        """
        file_name = urllib.parse.quote(file_name, safe='')
        destination = urllib.parse.quote(destination, safe='')

        file_download_api = '{}/{}/{}?destination={}&async={}'.format(
            self._start_url, 'download', file_name, destination,
            download_async)
        return api_util.get_url(file_download_api, self._user, self._password,
                                self._header)
Exemplo n.º 2
0
 def current_downloads(self):
     """GET list of files that are current downloading"""
     current_downloads_api = self._start_url + '/downloads?active=true'
     return api_util.get_url(current_downloads_api, self._user,
                             self._password, self._header)
Exemplo n.º 3
0
 def downloads_list(self):
     """GET list of all downloads"""
     downloads_list_api = self._start_url + '/downloads?active=false'
     return api_util.get_url(downloads_list_api, self._user, self._password,
                             self._header)
Exemplo n.º 4
0
 def active_providers(self):
     """GET list of active storage providers and corresponding settings"""
     providers_api = self._start_url + '/providers/active'
     return api_util.get_url(providers_api, self._user, self._password,
                             self._header)
Exemplo n.º 5
0
 def upload_status(self):
     """GET list of all files' status that are known to client"""
     file_list_api = self._start_url + '/files'
     return api_util.get_url(file_list_api, self._user, self._password,
                             self._header)
Exemplo n.º 6
0
 def info(self):
     """GET detailed client setting information"""
     return api_util.get_url(self._start_url, self._user, self._password,
                             self._header)
Exemplo n.º 7
0
 def contracts(self):
     """GET list of contracts that client formed with provider"""
     contracts_api = self._start_url + '/contracts'
     return api_util.get_url(contracts_api, self._user, self._password,
                             self._header)
Exemplo n.º 8
0
 def address_list(self):
     """GET list of addresses belong to the wallet"""
     addresses_api = self._start_url + '/addresses'
     return api_util.get_url(addresses_api, self._user, self._password,
                             self._header)
Exemplo n.º 9
0
 def info(self):
     """GET detailed Miner Status Information"""
     return api_util.get_url(self._start_url, self._user, self._password,
                             self._header)
Exemplo n.º 10
0
 def new_address(self):
     """Generate and GET new wallet address"""
     new_address_api = self._start_url + '/address'
     return api_util.get_url(new_address_api, self._user, self._password,
                             self._header)
Exemplo n.º 11
0
 def info(self) -> dict:
     """ GET detailed information of the network """
     return api_util.get_url(self._start_url, self._user, self._password,
                             self._header)
Exemplo n.º 12
0
 def block_by_id(self, block_id):
     """GET detailed block content based on the id of the block"""
     block_by_id_api = self._start_url + '/blocks?id=' + block_id
     return api_util.get_url(block_by_id_api, self._user, self._password,
                             self._header)
Exemplo n.º 13
0
 def block_by_height(self, block_height):
     """GET detailed block content based on the height of the block"""
     block_by_height_api = self._start_url + '/blocks?height=' + str(
         block_height)
     return api_util.get_url(block_by_height_api, self._user,
                             self._password, self._header)
Exemplo n.º 14
0
 def info(self):
     """GET detailed information on consensus set"""
     return api_util.get_url(self._start_url, self._user, self._password,
                             self._header)