How to check online/offline products with http response code?

Hi all,

Based on a previous issue , I try to check the http response code of each product_id, since the metadata are not reliable enough.

I’ve a snippet of code and I get response 401 (it seems that I don’t know use the credentials each time).

product_info = api.get_product_odata(id) is_online = product_info['Online'] url = product_info['url'] res = requests.get(url) print(res)

I also tried to use,auth = HTTPBasicAuth(‘username’,‘password’)) , but I got respone 500.

Did anyone face this problem? Any help will be useful.


You haven’t provided enough details: requests version, etc. This example using Python requests has worked well for me. For many linux distros it needs a newer version of requests than the original installation provides.

Thanks for your reply, yes I used the requests library 2.25.1. But I managed to solve it , by using instead of requests.get(url), the requests.head(url).