def mark_order_complete(order_id): api_request = {'command': 'orderFulfilled', 'data': str(order_id)} full_request = STORE_API_URL + "&" + generate(STORE_API_PRIVATE_KEY, api_request) http_request = urllib2.Request(url=full_request) try: response = urllib2.urlopen(http_request) except urllib2.URLError: return False json_response = response.read() return json.loads(json_response)['data']
def get_product_list(order_id): api_request = {'command': 'getProductsByInvoice', 'data': str(order_id)} full_request = STORE_API_URL + "&" + generate(STORE_API_PRIVATE_KEY, api_request) http_request = urllib2.Request(url=full_request) try: response = urllib2.urlopen(http_request) except urllib2.URLError: return (-1,) json_response = response.read() response_data = json.loads(json_response)['data'] if(response_data is None): return (-1,) else: return tuple(map(int, response_data))
def get_product_list(order_id): api_request = {'command': 'getProductsByInvoice', 'data': str(order_id)} full_request = STORE_API_URL + "&" + generate(STORE_API_PRIVATE_KEY, api_request) http_request = urllib2.Request(url=full_request) try: response = urllib2.urlopen(http_request) except urllib2.URLError: return (-1, ) json_response = response.read() response_data = json.loads(json_response)['data'] if (response_data is None): return (-1, ) else: return tuple(map(int, response_data))
finally: if con: con.close() slot = item_number api_request = { 'command': 'createOrder', 'data': { 'firstname': firstname, 'lastname': lastname, 'email': email, 'slot_number': slot } } full_request = STORE_API_URL + "&" + generate(STORE_API_PRIVATE_KEY, api_request) http_request = urllib2.Request(url=full_request) try: response = urllib2.urlopen(http_request) except urllib2.URLError: return False #response = urllib2.urlopen(http_request) json_response = response.read() return json.loads(json_response)['data'] if __name__ == '__main__': print create_order("05A0A92", 1)
if(count > 0): data = cur.fetchoneDict() firstname = data['first_name'] lastname = data['last_name'] email = data['email_address'] else: return False except mdb.Error, e: print "Error %d: %s" % (e.args[0],e.args[1]) finally: if con: con.close() slot = item_number api_request = {'command': 'createOrder', 'data': {'firstname': firstname, 'lastname': lastname, 'email': email, 'slot_number': slot}} full_request = STORE_API_URL + "&" + generate(STORE_API_PRIVATE_KEY, api_request) http_request = urllib2.Request(url=full_request) try: response = urllib2.urlopen(http_request) except urllib2.URLError: return False #response = urllib2.urlopen(http_request) json_response = response.read() return json.loads(json_response)['data'] if __name__ == '__main__': print create_order("05A0A92", 1)