How to properly do requests to a https with a proxy server such as luminati.io?
When changing proxies={"https":proxy}
to proxies={"http":proxy}
you also have to make sure your link is http
and not https
so also try replacing:
link = 'https://www.experiment.com.ph/catalog/?_keyori=ss&ajax=true&from=input&page='+str(i)+'&q='+str(search_keyword)+'&spm=a2o4l.home.search.go.239e6ef06RRqVD'
with
link = 'http://www.experiment.com.ph/catalog/?_keyori=ss&ajax=true&from=input&page='+str(i)+'&q='+str(search_keyword)+'&spm=a2o4l.home.search.go.239e6ef06RRqVD'
Your overall code should look like this:
headers = {'USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0'}if __name__ == "__main__": search_keyword = input("Enter the search keyword: ") page_number = int(input("Enter total number of pages: ")) for i in range(1,page_number+1): time.sleep(10) link = 'http://www.experiment.com.ph/catalog/?_keyori=ss&ajax=true&from=input&page='+str(i)+'&q='+str(search_keyword)+'&spm=a2o4l.home.search.go.239e6ef06RRqVD' proxy = proxy_dictionary["ip"] + ':' + str(proxy_dictionary["asn"]["asnum"]) print(proxy) req = requests.get(link,headers=headers,proxies={"http":proxy})
Hope this helps!
A little late to the party but this is what worked for me.
proxies = {'http': 'http://lum-customer-hl_1247574f-zone-static:lnheclanmc@127.0.3.1:20005', 'https': 'http://lum-customer-hl_1247574f-zone-static:lnheclanmc@127.0.3.1:20005'} req = requests.get(link,headers=headers,proxies=proxies)
After defining the proxies like this, I was able to hit the link and get a response. I believe luminati requires the credentials for rotating and hitting the links from their proxies