def edit_multiple_ship_price(execute_command): if 'access_token' in execute_command: access_token = wish_common.is_null_field( execute_command['access_token']) if 'product_id' in execute_command: product_id = wish_common.is_null_field( execute_command['product_id']) if 'CA' in execute_command: CA = quote(execute_command['CA']) if 'AU' in execute_command: AU = quote(execute_command['AU']) if 'use_product_shipping_countries' in execute_command: use_product_shipping_countries = quote( execute_command['use_product_shipping_countries']) if 'disabled_countries' in execute_command: disabled_countries = quote(execute_command['disabled_countries']) if 'wish_express_add_countries' in execute_command: wish_express_add_countries = quote( execute_command['wish_express_add_countries']) if 'wish_express_remove_countries' in execute_command: wish_express_remove_countries = quote( execute_command['wish_express_remove_countries']) if 'default_shipping_price' in execute_command: default_shipping_price = quote( execute_command['default_shipping_price']) if 'warehouse_name' in execute_command: warehouse_name = quote(execute_command['warehouse_name']) url = "https://merchant.wish.com/api/v2/product/update-multi-shipping?access_token=%s&id=%s&CA=%s&AU=%s&use_product_shipping_countries=%s&disabled_countries=%s&" \ "wish_express_add_countries=%s&wish_express_remove_countries=%s&default_shipping_price=%s&warehouse_name=%s"%(access_token, product_id, CA, AU, use_product_shipping_countries, disabled_countries,wish_express_add_countries,wish_express_remove_countries,default_shipping_price,warehouse_name) r = requests.post(url) result = r.text return result
def update_product(execute_command): # access_token = wish_common.get_wish_access(execute_command['store_id']) # product_id = quote(execute_command['product_id']) # name = quote(execute_command['name']) # description = quote(execute_command['description']) # tags = quote(execute_command['tags']) params = 'access_token' + '=' + execute_command['access_token'] if 'product_id' in execute_command: product_id = wish_common.is_null_field( execute_command['product_id']) params = params + '&id' + '=' + product_id if 'name' in execute_command: name = wish_common.is_null_field(execute_command['name']) params = params + '&name' + '=' + name if 'description' in execute_command: description = wish_common.is_null_field( execute_command['description']) params = params + '&description' + '=' + description if 'tags' in execute_command: tags = wish_common.is_null_field(execute_command['tags']) params = params + '&tags' + '=' + tags url = "https://merchant.wish.com/api/v2/product/update?" + params r = requests.post(url) result = r.text return result
def enable_variation_product(execute_command): if 'access_token' in execute_command: access_token = wish_common.is_null_field( execute_command['access_token']) if 'sku' in execute_command: sku = wish_common.is_null_field(execute_command['sku']) url = "https://merchant.wish.com/api/v2/variant/enable?access_token=%s&sku=%s" % ( access_token, sku) r = requests.post(url) result = r.text return result
def fetch_notifications(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'start' in execute_command: start = wish_common.is_null_field(execute_command['start']) params = params + '&start' + '=' + start if 'limit' in execute_command: limit = wish_common.is_null_field(execute_command['limit']) params = params + '&limit' + '=' + limit url = "https://merchant.wish.com/api/v2/noti/fetch-unviewed?" + params r = requests.post(url) result = r.text return result
def update_inventory(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'sku' in execute_command: sku = wish_common.is_null_field(execute_command['sku']) params = params + '&sku' + '=' + sku if 'inventory' in execute_command: inventory = wish_common.is_null_field(execute_command['inventory']) params = params + '&inventory' + '=' + inventory url = "https://merchant.wish.com/api/v2/variant/update-inventory?"+params r = requests.post(url) result = r.text return result
def add_budget_campagin(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'id' in execute_command: id = wish_common.is_null_field(execute_command['id']) params = params + '&id=' + id if 'amount' in execute_command: amount = wish_common.is_null_field(execute_command['amount']) params = params + '&amount=' + amount url = "https://merchant.wish.com/api/v2/product-boost/campaign/add-budget?" + params r = requests.post(url) result = r.text return result
def update_price(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'sku' in execute_command: sku = wish_common.is_null_field(execute_command['sku']) params = params + '&sku' + '=' + sku if 'new_price' in execute_command: new_price = wish_common.is_null_field(execute_command['new_price']) params = params + '&price' + '=' + new_price url = "https://merchant.wish.com/api/v2/variant/update?"+params r = requests.post(url) result = r.text return result
def retrieve_order(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'order_id' in execute_command: order_id = wish_common.is_null_field(execute_command['order_id']) params = params + '&id' + '=' + order_id if 'show_original_shipping_detail' in execute_command: show_shipping_detail = wish_common.is_null_field( execute_command['show_original_shipping_detail']) params = params + '&show_original_shipping_detail' + '=' + show_shipping_detail url = "https://merchant.wish.com/api/v2/order?" + params r = requests.post(url) result = r.text return result
def remove_extra_images(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'product_id' in execute_command: product_id = wish_common.is_null_field( execute_command['product_id']) params = params + '&id' + '=' + product_id if 'sku' in execute_command: sku = wish_common.is_null_field(execute_command['sku']) params = params + '&sku' + '=' + sku url = "https://merchant.wish.com/api/v2/product/remove-extra-images?" + params r = requests.post(url) result = r.text return result
def get_shipping_price(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'product_id' in execute_command: product_id = wish_common.is_null_field( execute_command['product_id']) params = params + '&id' + '=' + product_id if 'country' in execute_command: country = wish_common.is_null_field(execute_command['country']) params = params + '&country' + '=' + country url = "https://merchant.wish.com/api/v2/product/get-shipping?" + params r = requests.post(url) result = r.text return result
def list_low_budget_campaigns(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'start' in execute_command: start = wish_common.is_null_field(execute_command['start']) if start: params = params + '&start=' + start if 'limit' in execute_command: limit = wish_common.is_null_field(execute_command['limit']) if limit: params = params + '&limit=' + limit url = "https://merchant.wish.com/api/v2/product-boost/campaign/list-low-budget?" + params r = requests.post(url) result = r.text return result
def retrieve_product(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'product_id' in execute_command: product_id = wish_common.is_null_field( execute_command['product_id']) params = params + '&id' + '=' + product_id if 'parent_sku' in execute_command: parent_sku = wish_common.is_null_field( execute_command['parent_sku']) params = params + '&parent_sku' + '=' + parent_sku url = "https://merchant.wish.com/api/v2/product?" + params r = requests.post(url) result = r.text return result
def get_campagin_daily_stats(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'campaign_id' in execute_command: campaign_id = wish_common.is_null_field( execute_command['campaign_id']) params = params + '&campaign_id=' + campaign_id if 'product_id' in execute_command: product_id = wish_common.is_null_field( execute_command['product_id']) params = params + '&product_id=' + product_id url = "https://merchant.wish.com/api/v2/product-boost/campaign/get-product-daily-stats?" + params r = requests.post(url) result = r.text return result
def bulk_update_variation_job_success(execute_command): if 'access_token' in execute_command: access_token = wish_common.is_null_field( execute_command['access_token']) if 'job_id' in execute_command: job_id = wish_common.is_null_field(execute_command['job_id']) if 'start' in execute_command: start = wish_common.is_null_field(execute_command['start']) if 'limit' in execute_command: limit = wish_common.is_null_field(execute_command['limit']) url = "https://merchant.wish.com/api/v2/variant/get-bulk-update-job-successes?job_id=%s&access_token=%s&start=%s&limit=%s" % ( job_id, access_token, start, limit) r = requests.post(url) result = r.text return result
def list_all_variation_product(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'start' in execute_command: start = wish_common.is_null_field(execute_command['start']) params = params + '&start' + '=' + start if 'limit' in execute_command: limit = wish_common.is_null_field(execute_command['limit']) params = params + '&limit' + '=' + limit if 'warehouse_name' in execute_command: warehouse_name = wish_common.is_null_field( execute_command['warehouse_name']) params = params + '&warehouse_name' + '=' + warehouse_name url = "https://merchant.wish.com/api/v2/variant/multi-get?" + params r = requests.post(url) result = r.text return result
def refund_order(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'order_id' in execute_command: order_id = wish_common.is_null_field(execute_command['order_id']) params = params + '&id' + '=' + order_id if 'reason_code' in execute_command: reason_code = wish_common.is_null_field( execute_command['reason_code']) params = params + '&reason_code' + '=' + reason_code if 'reason_note' in execute_command: reason_note = wish_common.is_null_field( execute_command['reason_note']) params = params + '&reason_note' + '=' + reason_note url = "https://merchant.wish.com/api/v2/order/refund?" + params r = requests.post(url) result = r.text return result
def modify_address_order(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'order_id' in execute_command: order_id = wish_common.is_null_field(execute_command['order_id']) params = params + '&id' + '=' + order_id if 'street_address1' in execute_command: street_address1 = wish_common.is_null_field( execute_command['street_address1']) params = params + '&street_address1' + '=' + street_address1 if 'street_address2' in execute_command: street_address2 = wish_common.is_null_field( execute_command['street_address2']) params = params + '&street_address2' + '=' + street_address2 if 'city' in execute_command: city = wish_common.is_null_field(execute_command['city']) params = params + '&city' + '=' + city if 'state' in execute_command: state = wish_common.is_null_field(execute_command['state']) params = params + '&state' + '=' + state if 'zipcode' in execute_command: zipcode = wish_common.is_null_field(execute_command['zipcode']) params = params + '&zipcode' + '=' + zipcode if 'phone_number' in execute_command: phone_number = wish_common.is_null_field( execute_command['phone_number']) params = params + '&phone_number' + '=' + phone_number url = "https://merchant.wish.com/api/v2/order/change-shipping?" + params r = requests.post(url) result = r.text return result
def update_campagin(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'id' in execute_command: id = wish_common.is_null_field(execute_command['id']) params = params + '&id=' + id if 'max_budget' in execute_command: max_budget = wish_common.is_null_field( execute_command['max_budget']) params = params + '&max_budget=' + max_budget if 'auto_renew' in execute_command: auto_renew = wish_common.is_null_field( execute_command['auto_renew']) params = params + '&auto_renew=' + auto_renew if 'campaign_name' in execute_command: campaign_name = wish_common.is_null_field( execute_command['campaign_name']) params = params + '&campaign_name=' + campaign_name if 'start_date' in execute_command: start_date = wish_common.is_null_field( execute_command['start_date']) params = params + '&start_date=' + start_date if 'end_date' in execute_command: end_date = wish_common.is_null_field(execute_command['end_date']) params = params + '&end_date=' + end_date if 'products' in execute_command: products = wish_common.is_null_field(execute_command['products']) params = params + '&products=' + products url = "https://merchant.wish.com/api/v2/product-boost/campaign/update?" + params r = requests.post(url) result = r.text return result
def search_keywords(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'keyword' in execute_command: keyword = wish_common.is_null_field(execute_command['keyword']) params = params + '&keyword=' + keyword if 'exclude_keywords' in execute_command: exclude_keywords = wish_common.is_null_field( execute_command['exclude_keywords']) if exclude_keywords: params = params + '&exclude_keywords=' + exclude_keywords if 'limit' in execute_command: limit = wish_common.is_null_field(execute_command['limit']) if limit: params = params + '&limit=' + limit url = "https://merchant.wish.com/api/v2/product-boost/keyword/search?" + params r = requests.post(url) result = r.text return result
def cancel_batch_product_download(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'job_id' in execute_command: job_id = wish_common.is_null_field(execute_command['job_id']) params = params + '&job_id' + '=' + job_id url = "https://merchant.wish.com/api/v2/product/cancel-download-job?" + params r = requests.post(url) result = r.text return result
def get_infractions_count(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'stage' in execute_command: stage = wish_common.is_null_field(execute_command['stage']) params = params + '&stage' + '=' + stage url = "https://merchant.wish.com/api/v2/count/infractions?"+params r = requests.post(url) result = r.text return result
def get_fine(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'id' in execute_command: id = wish_common.is_null_field(execute_command['id']) params = params + '&id' + '=' + id url = "https://merchant.wish.com/api/v2/fine?"+params r = requests.post(url) result = r.text return result
def bulk_update_variation_job_errors(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'job_id' in execute_command: job_id = wish_common.is_null_field(execute_command['job_id']) params = params + '&job_id' + '=' + job_id url = "https://merchant.wish.com/api/v2/variant/get-bulk-update-job-failures?" + params r = requests.post(url) result = r.text return result
def bulk_update_variation_product(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'updates' in execute_command: updates = wish_common.is_null_field(execute_command['updates']) params = params + '&updates' + '=' + updates url = "https://merchant.wish.com/api/v2/variant/bulk-sku-update?format=json" + params r = requests.post(url) result = r.text return result
def get_keywords(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'keywords' in execute_command: keywords = wish_common.is_null_field(execute_command['keywords']) params = params + '&keywords=' + keywords url = "https://merchant.wish.com/api/v2/product-boost/keyword/multi-get?" + params r = requests.post(url) result = r.text return result
def batch_order_download(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'start' in execute_command: start = wish_common.is_null_field(execute_command['start']) params = params + '&start' + '=' + start if 'end' in execute_command: end = wish_common.is_null_field(execute_command['end']) params = params + '&end' + '=' + end if 'limit' in execute_command: limit = wish_common.is_null_field(execute_command['limit']) params = params + '&limit' + '=' + limit if 'sort' in execute_command: sort = wish_common.is_null_field(execute_command['sort']) params = params + '&sort' + '=' + sort url = "https://merchant.wish.com/api/v2/order/create-download-job?" + params r = requests.post(url) result = r.text return result
def get_campagin_performance(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'id' in execute_command: id = wish_common.is_null_field(execute_command['id']) params = params + '&id=' + id url = "https://merchant.wish.com/api/v2/product-boost/campaign/get-performance?" + params r = requests.post(url) result = r.text return result
def mark_as_viewed(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'noti_id' in execute_command: noti_id = wish_common.is_null_field(execute_command['noti_id']) params = params + '¬i_id' + '=' + noti_id url = "https://merchant.wish.com/api/v2/noti/mark-as-viewed?" + params r = requests.post(url) result = r.text return result
def get_order_by_job_id(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'job_id' in execute_command: job_id = wish_common.is_null_field(execute_command['job_id']) params = params + '&job_id' + '=' + job_id url = "https://merchant.wish.com/api/v2/order/create-download-job?"+params r = requests.post(url) result = r.text return result
def disable_variation_product(execute_command): params = 'access_token' + '=' + execute_command['access_token'] if 'sku' in execute_command: sku = wish_common.is_null_field(execute_command['sku']) params = params + '&sku' + '=' + sku url = "https://merchant.wish.com/api/v2/variant/disable?" + params r = requests.post(url) result = r.text return result