def getAccessToken(self): """ Request new access token and save in session """ method = 'POST' url = 'oauth/access_token' param = { 'client_id' : self.client_id, 'client_secret' : self.secret_key, 'grant_type' : self._GRANT_TYPE, 'scope' : self._SCOPE } res = apirequest.ApiCall(self.username, self.password).call(method, url, param) self.session.create(json.loads(res))
def productList(self): data = {'access_token' : self.access_token} method = 'GET' url = 'products/?' + urlencode(data) return apirequest.ApiCall(self.username, self.password).call(method, url)
def invoiceCreate(self, data): data['access_token'] = self.access_token method = 'POST' url = 'invoice/' return apirequest.ApiCall(self.username, self.password).call(method, url, data)
def invoiceInfo(self, invoice_id): data = {'access_token' : self.access_token} method = 'GET' url = 'invoice/' + invoice_id + '?' + urlencode(data) return apirequest.ApiCall(self.username, self.password).call(method, url)
def buyerInfo(self, buyer_id): data = {'access_token' : self.access_token} method = 'GET' url = 'buyer/' + buyer_id + '?' + urlencode(data) return apirequest.ApiCall(self.username, self.password).call(method, url)
def productUpdate(self, product_id, data): data['access_token'] = self.access_token method = 'PUT' url = 'products/' + product_id + '?' + urlencode(data) return apirequest.ApiCall(self.username, self.password).call(method, url, data)
def productInfo(self, product_id): data = {'access_token' : self.access_token} method = 'GET' url = 'products/' + product_id + '?' + urlencode(data) return apirequest.ApiCall(self.username, self.password).call(method, url)