Пример #1
0
	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))
Пример #2
0
	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)
Пример #3
0
	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)
Пример #4
0
	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)
Пример #5
0
	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)
Пример #6
0
	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)
Пример #7
0
	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)