0

I need to send a request to get all cruise information from this web page: https://www.ncl.com Problem is that i am in Europe and i need the prices to be in US dollars. Somehow the page "knows" where i am and i cant get it to return currency other than EUR. Is there a way to do that programmatically? So far my request is this:

session = requests.session()
headers = {
    "authority": "www.ncl.com",
    "method": "GET",
    "path": "/ca/en/search_vacations",
    "scheme": "https",
    "accept": "application/json, text/plain, */*",
    "connection": "keep-alive",
    "referer": "https://www.ncl.com/ca/en/",
    "cookie":"AkaUTrackingID=5D33489F106C004C18DFF0A6C79B44FD; AkaSTrackingID=F942E1903C8B5868628CF829225B6C0F; UrCapture=1d20f804-718a-e8ee-b1d8-d4f01150843f; BIGipServerpreprod2_www2.ncl.com_http=61515968.20480.0000; _gat_tealium_0=1; BIGipServerpreprod2_www.ncl.com_r4=1957341376.10275.0000; MP_COUNTRY=us; MP_LANG=en; mp__utma=35125182.281213660.1481488771.1481488771.1481488771.1; mp__utmc=35125182; mp__utmz=35125182.1481488771.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); utag_main=_st:1481490575797$ses_id:1481489633989%3Bexp-session; s_pers=%20s_fid%3D37513E254394AD66-1292924EC7FC34CB%7C1544560775848%3B%20s_nr%3D1481488775855-New%7C1484080775855%3B; s_sess=%20s_cc%3Dtrue%3B%20c%3DundefinedDirect%2520LoadDirect%2520Load%3B%20s_sq%3D%3B; _ga=GA1.2.969979116.1481488770; mp__utmb=35125182; NCL_LOCALE=en-US; SESS93afff5e686ba2a15ce72484c3a65b42=5ecffd6d110c231744267ee50e4eeb79; ak_location=US,NY,NEWYORK,501; Ncl_region=NY; optimizelyEndUserId=oeu1481488768465r0.23231006365903206",
    "Proxy-Authorization": "Basic QFRLLTVmZjIwN2YzLTlmOGUtNDk0MS05MjY2LTkxMjdiMTZlZTI5ZDpAVEstNWZmMjA3ZjMtOWY4ZS00OTQxLTkyNjYtOTEyN2IxNmVlMjlk"
}
session.headers.update(headers)
url = "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=" + str(page_counter) + "&sortBy=Featured&autoPopulate=f&from=resultPage"
    page = session.get(url)
    cruise_results = page.json()

I really need to do that without using VPN tunnelling or proxies. The cookie i am using was not the first i've tried. This one above, is the one ive got when i tunneled the connection and opened the page from USA. Didn't do the job so i guess the cookie is not involved. I'm still quite new at this.

2 Answers 2

2

Somehow the page "knows" where i am and i cant get it to return currency other than EUR.

You have to debug/experiment -- it's the server logic/code, which you don't know.

Most probably they detect your location by your IP address, then you need to use a proxy server.

It could also be, that the cookies you are using have some info which defines your user settings (for example I find in it MP_COUNTRY=us;).

Some sites use a special GET argument (for example country=US, or region or whatever), which overrides the country/region deduced from your IP -- look for it, maybe you have luck.

Sign up to request clarification or add additional context in comments.

6 Comments

well, as i said, this is a cookie, properly generated from a visit via VPN tunnel. If it's the cookie, my need to work.
So, when you first did the request through the USA tunnel, the prices were in USD?
Yes. Problem is replicating this in the code when the program is run from Europe
I am afraid, you have no choice -- you must use tunnels or proxy servers. The IP datagram contains the sender's IP address -- you cannot tamper with it.
|
0

It's more than likely determining your location through your IP address. I do not believe there is a way to change this programmatically as it is provided by your ISP. You will need to set up a VPN or proxy to do this. Why do you say you need to do it without a VPN? They're really easy to set up if that's the worry.

2 Comments

Program will be run from different locations and prefer all those settings to be done in code. Is there a way to send only a request via proxy? Maybe set up that in code?
I don't believe so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.