Пример #1
0
 def query_by_following_seller(self):
     header = {"MARKET-KEY": self.public_key, "MARKET-TOKEN": self.token,
               'Content-Type': 'application/json'}
     url = utils.build_url(self.url + "product/v1/my_seller/product/search/")
     logger.debug(url)
     resp = yield treq.get(url, headers=header)
     logger.debug(resp)
     comment_info = yield treq.json_content(resp)
     logger.debug('query by following tag confirm: %s', comment_info)
     return comment_info['data']
Пример #2
0
 def query_comment_by_hash(self, market_hash):
     header = {"MARKET-KEY": self.public_key, "MARKET-TOKEN": self.token,
               'Content-Type': 'application/json'}
     url = utils.build_url(self.url + "comment/v1/comment/list/", {'market_hash': market_hash})
     logger.debug(url)
     resp = yield treq.get(url, headers=header)
     logger.debug(resp)
     comment_info = yield treq.json_content(resp)
     logger.debug('upload file info to market confirm: %s', comment_info)
     return comment_info['data']
Пример #3
0
 def query_records(self, address):
     url = self.url + 'records/v1/record/'
     header = {
         "MARKET-KEY": self.public_key,
         "MARKET-TOKEN": self.token,
         'Content-Type': 'application/json'
     }
     url = utils.build_url(url, {'address': address})
     resp = yield treq.get(url, headers=header, persistent=False)
     data_info = yield treq.json_content(resp)
     return data_info
Пример #4
0
 def query_data(self, market_hash):
     url = self.url + 'user_data/v1/uploaded_file/item/'
     header = {
         "MARKET-KEY": self.public_key,
         "MARKET-TOKEN": self.token,
         'Content-Type': 'application/json'
     }
     url = utils.build_url(url, {'market_hash': market_hash})
     resp = yield treq.get(url, headers=header, persistent=False)
     data_info = yield treq.json_content(resp)
     return data_info
Пример #5
0
    def add_comment_by_hash(self, market_hash, comment=""):
        comment_address = ECCipher.get_address_from_public_key(self.account.public_key)
        logger.debug(comment_address)
        header = {"MARKET-KEY": self.public_key, "MARKET-TOKEN": self.token, 'Content-Type': 'application/json'}
        data = {'public_key': self.public_key, 'market_hash': market_hash, 'content': comment}
        url = utils.build_url(self.url + "comment/v1/comment/add/", {'market_hash': market_hash})

        resp = yield treq.post(url, headers=header, json=data, persistent=False)
        comment_info = yield treq.json_content(resp)
        logger.debug('upload file info to market confirm: %s', comment_info)
        return comment_info['status']
Пример #6
0
 def myproducts(self):
     header = {
         "MARKET-KEY": self.public_key,
         "MARKET-TOKEN": self.token,
         'Content-Type': 'application/json'
     }
     url = utils.build_url(self.url + "product/v1/allproducts/my_products/",
                           {})
     logger.debug(url)
     resp = yield treq.get(url, headers=header)
     products_info = yield treq.json_content(resp)
     return products_info
Пример #7
0
 def products(self, search=None):
     header = {
         "MARKET-KEY": self.public_key,
         "MARKET-TOKEN": self.token,
         'Content-Type': 'application/json'
     }
     query = {}
     if search:
         query['keyword'] = search
     url = utils.build_url(self.url + "product/v1/allproducts/", query)
     logger.debug(url)
     resp = yield treq.get(url, headers=header)
     product_info = yield treq.json_content(resp)
     return product_info