Hi everyone I'm trying to put a Put on woocommerce I extracted the product_id from a csv now I should pass it to the put method
documentation:
https: //woocommerce.github.io/woocommerce-rest-api-docs
but I get this error:
{'code': 'rest_no_route', 'message': "No route provides a match between the URL and the requested method.", 'data': {'status': 404}}
I tried to print the result it should be 774 but I see that it also returns the default index of the Dataframe that is:
0 | 774 I have to remove that index, I think that's the problem
my code:
documentation:
https: //woocommerce.github.io/woocommerce-rest-api-docs
but I get this error:
{'code': 'rest_no_route', 'message': "No route provides a match between the URL and the requested method.", 'data': {'status': 404}}
I tried to print the result it should be 774 but I see that it also returns the default index of the Dataframe that is:
0 | 774 I have to remove that index, I think that's the problem
my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
from woocommerce import API import pandas as pd def update( id ): data = { "stock_quantity" : "0" } print (wcapi.put( "products/" + id , data).json()) wcapi = API( consumer_key = "ck_e985f38b7c-------" , consumer_secret = "cs_e03fab956a2835990e0----------" , wp_api = True , version = "wc/v3" ) df1 = pd.read_csv( 'eurogold.csv' , index_col = 0 ) df1 = df1.drop_duplicates([ 'codbar' ]) # elimina duplicati df1[ 'codbar' ] = df1[ 'codbar' ].astype( str ) print (df1) df2 = pd.read_csv( 'woo.csv' , index_col = 0 ) df2 = df2.dropna().reset_index(drop = True ) print (df2) risultato = df2[df2.sku.isin(df1.codbar)].astype( str ) for index, row in risultato.iterrows(): update(risultato.product_id) |