skyscanner - Getting the error "ApiKey invalid" for hotel live prices -


i'm trying list of current hotel prices can't api key work. i've had couple days know isn't new. tried example in docs (after fixing dates):

http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v2/uk/eur/en-gb/27539733/2016-12-04/2016-12-10/2/1?apikey=mykey

while worked demo key wouldn't work mine. tried on ec2 micro i'm using testing python , response u'{"errors":["apikey invalid"]}':

sky_scan_url = "http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v2/" sky_key = get_sky_scan_key() def get_hotels(request):         entityid = request.get['entityid']         checkindate = date_formatter(request.get['start'])         checkoutdate = date_formatter(request.get['end'])         rooms = request.get['rooms']         guests = request.get['guests']         final_sky_url = "%s/%s/%s/%s/%s/%s/%s/%s/%s/?apikey=%s" % (             sky_scan_url, 'us', 'usd', 'en-us', entityid, checkindate, checkoutdate, guests, rooms, sky_key)          sky_response = requests.get(final_sky_url) 

this function outputs request url this: http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v2//us/usd/en-us/20.7983626,-156.3319253-latlong/2016-09-07/2016-09-14/1/1/?apikey=mykey

any advice on possible issue awesome, thanks!

edit: more specific i'm looking reasons why api key invalid. i'm not familiar skyscan , while i've added app skyscanner dashboard clicking travel api , copied key project , directly valid url key showing bad. there additional steps or things need take account?

i don't know how you're creating url seems shouldn't built way. (most due misleading documentation)

this:

http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v3/?apikey=mykey&checkoutdate=2016-09-14&checkindate=2016-09-07&currency=usd&rooms=1&entityid=20.7983626%2c-156.3319253-latlong&local=en-us&market=us&guests=1 

should be:

http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v3/us/usd/en-us/20.7983626,-156.3319253-latlong/2016-09-07/2016-09-14/1/1/?apikey=mykey 

your code should like:

sky_scan_url = "http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v3/" final_url = "%s/%s/%s/%s/%s/%s/%s/%s/%s/?apikey=%s" % (sky_scan_url, market, currency, locale, entityid, checkindate, checkoutdate, guests, rooms, apikey)  sky_response = requests.get(final_url) 

i suggest tests here.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -