我需要在python中使用http
发送requests
请求。代理需要在美国,所以我得到美国货币。
到目前为止,我做到了这一点:
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¤tPage=", proxies=proxies)
cruise_results = response.json()
for line in cruise_results['results']:
print(line)
尝试了几种不同的IP /端口组合,但我仍然得到欧元价格。我做错了吗?
答案 0 :(得分:1)
proxies
dictionary应该有http
和https
个键。 不 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¤tPage=", proxies=proxies)