Search code examples
pythonpython-3.xpython-requestspython-3.5http-proxy

Sending a request via proxy doesn't work


I need to send a http request with requests in python. Proxy need to be in US so i get american currency. So far i did this:

import requests
proxies = {'httpс': 'httpс://97.77.104.22:3128'}

response = requests.get("https://www.ncl.com/ca/en/search_vacations?cruise=1&cruiseTour=1&cruiseHotel=1&cruiseHotelAir=1&flyCruise=1&numberOfGuests=4294953449&state=undefined&pageSize=10&currentPage=", proxies=proxies)
cruise_results = response.json()
for line in cruise_results['results']:
    print(line)

Tried with several different IP/Port combinations but i still get the EUR prices. Am i doing something wrong?


Solution

  • The proxies dictionary should have http and https keys. Not httpc

    import requests
    proxies = {'https': 'httpс://97.77.104.22:3128'}
    
    response = requests.get("https://www.ncl.com/ca/en/search_vacations?cruise=1&cruiseTour=1&cruiseHotel=1&cruiseHotelAir=1&flyCruise=1&numberOfGuests=4294953449&state=undefined&pageSize=10&currentPage=", proxies=proxies)