Skip to content

Commit

Permalink
Merge 0e51465 into 26ce4a5
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolovNikolay committed Apr 22, 2020
2 parents 26ce4a5 + 0e51465 commit 9a9d561
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 150 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ language: python

python:
- "3.4"
- "3.3"
- "2.7"
- "pypy"
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
Expand All @@ -15,5 +14,5 @@ install:
script:
- flake8
- python runtests.py
- coverage run --source skyscanner setup.py test
after_success: coveralls
- coverage run --source skyscanner setup.py test
after_success: coveralls
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Skyscanner Python SDK
===============================

You will need to contact us to request an API key to use our APIs via the following form: https://partners.skyscanner.net/contact.
You will need to contact us to request an API key to use our APIs via the following form: https://partners.skyscanner.net/contact.

We receive a large number of requests and although we do our best to reply to all we cannot guarantee that your application will be successful.
We receive a large number of requests and although we do our best to reply to all we cannot guarantee that your application will be successful.

.. image:: https://api.travis-ci.org/Skyscanner/skyscanner-python-sdk.svg
:target: https://travis-ci.org/Skyscanner/skyscanner-python-sdk
Expand All @@ -24,7 +24,7 @@ Skyscanner Python SDK for Skyscanner's API

* Free software: Apache license
* SDK Documentation: https://skyscanner.readthedocs.org.
* API Documentation: http://business.skyscanner.net/portal/en-GB/Documentation/ApiOverview
* API Documentation: https://business.skyscanner.net/portal/en-GB/Documentation/ApiOverview


Features
Expand Down Expand Up @@ -87,7 +87,7 @@ For more example usage, refer to the `SDK documentation`_ or the `API documentat

.. _SDK documentation: https://skyscanner.readthedocs.org/en/latest/usage.html
.. _API documentation: https://skyscanner.github.io/slate/


Known Issues
------------
Expand All @@ -97,7 +97,7 @@ Known Issues
requests.exceptions.HTTPError: 429 Client Error: Too many requests in the last minute.

* Please allow up to 15 minutes for your API key to be activated. Until it is activated you will get a 403 exception::
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http://partners.api.skyscanner.net/apiservices/pricing/v1.0?apiKey=<Your API key>

requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://partners.api.skyscanner.net/apiservices/pricing/v1.0?apiKey=<Your API key>


114 changes: 57 additions & 57 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ To use Skyscanner Python SDK in a project, you will need to request an API key.
Once you have an API key you can set it as follows:

from skyscanner.skyscanner import Flights
flights_service = Flights('<Your API Key>')

flights_service = Flights('<Your API Key>')


Flights: Live Pricing
~~~~~~~~~~~~~~~~~~~~~

http://business.skyscanner.net/portal/en-GB/Documentation/FlightsLivePricingList
https://business.skyscanner.net/portal/en-GB/Documentation/FlightsLivePricingList

Get live prices::

from skyscanner.skyscanner import Flights

flights_service = Flights('<Your API Key>')
result = flights_service.get_result(
country='UK',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2017-05-28',
inbounddate='2017-05-31',
country='UK',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2017-05-28',
inbounddate='2017-05-31',
adults=1).parsed

Flights: Browse Cache
~~~~~~~~~~~~~~~~~~~~~

http://business.skyscanner.net/portal/en-GB/Documentation/FlightsBrowseCacheOverview
https://business.skyscanner.net/portal/en-GB/Documentation/FlightsBrowseCacheOverview

Cheapest quotes::

Expand All @@ -43,11 +43,11 @@ Cheapest quotes::
flights_cache_service = FlightsCache('<Your API Key>')
result = flights_cache_service.get_cheapest_quotes(
market='UK',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2017-05',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2017-05',
inbounddate='2017-06').parsed

Cheapest price by route::
Expand All @@ -57,11 +57,11 @@ Cheapest price by route::
flights_cache_service = FlightsCache('<Your API Key>')
result = flights_cache_service.get_cheapest_price_by_route(
market='UK',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2017-05',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2017-05',
inbounddate='2017-06').parsed

Cheapest price by date::
Expand All @@ -71,11 +71,11 @@ Cheapest price by date::
flights_cache_service = FlightsCache('<Your API Key>')
result = flights_cache_service.get_cheapest_price_by_date(
market='UK',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2017-05',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2017-05',
inbounddate='2017-06').parsed

Grid of prices by date::
Expand All @@ -85,31 +85,31 @@ Grid of prices by date::
flights_cache_service = FlightsCache('<Your API Key>')
result = flights_cache_service.get_grid_prices_by_date(
market='UK',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2017-05',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2017-05',
inbounddate='2017-06').parsed

Car Hire
~~~~~~~~

http://business.skyscanner.net/portal/en-GB/Documentation/CarHireLivePricing
https://business.skyscanner.net/portal/en-GB/Documentation/CarHireLivePricing

Get live prices::

from skyscanner.skyscanner import CarHire

carhire_service = CarHire('<Your API Key>')
result = carhire_service.get_result(
market='UK',
currency='GBP',
locale='en-GB',
pickupplace='LHR-sky',
dropoffplace='LHR-sky',
pickupdatetime='2017-05-29T12:00',
dropoffdatetime='2017-05-29T18:00',
market='UK',
currency='GBP',
locale='en-GB',
pickupplace='LHR-sky',
dropoffplace='LHR-sky',
pickupdatetime='2017-05-29T12:00',
dropoffdatetime='2017-05-29T18:00',
driverage='30',
userip='175.156.244.174').parsed

Expand All @@ -119,25 +119,25 @@ Car hire autosuggest::

carhire_service = CarHire('<Your API Key>')
result = carhire_service.location_autosuggest(
market='UK',
currency='GBP',
locale='en-GB',
market='UK',
currency='GBP',
locale='en-GB',
query='Kuala').parsed

Hotels
~~~~~~

http://business.skyscanner.net/portal/en-GB/Documentation/HotelsOverview
https://business.skyscanner.net/portal/en-GB/Documentation/HotelsOverview

Hotels autosuggest::

from skyscanner.skyscanner import Hotels

hotels_service = Hotels('<Your API Key>')
result = hotels_service.location_autosuggest(
market='UK',
currency='GBP',
locale='en-GB',
market='UK',
currency='GBP',
locale='en-GB',
query='Kuala').parsed

Hotels prices and details::
Expand All @@ -146,11 +146,11 @@ Hotels prices and details::

hotels_service = Hotels(self.api_key)
result = hotels_service.get_result(
market='UK',
currency='GBP',
locale='en-GB',
entityid=27543923,
checkindate='2017-05-26',
checkoutdate='2017-05-30',
guests=1,
rooms=1).parsed
market='UK',
currency='GBP',
locale='en-GB',
entityid=27543923,
checkindate='2017-05-26',
checkoutdate='2017-05-30',
guests=1,
rooms=1).parsed
17 changes: 9 additions & 8 deletions skyscanner/skyscanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def configure_logger(log_level=logging.WARN):
logger.addHandler(sa)
return logger


log = configure_logger()
STRICT, GRACEFUL, IGNORE = 'strict', 'graceful', 'ignore'

Expand Down Expand Up @@ -73,7 +74,7 @@ class Transport(object):
"""
Parent class for initialization
"""
API_HOST = 'http://partners.api.skyscanner.net'
API_HOST = 'https://partners.api.skyscanner.net'
MARKET_SERVICE_URL = '{api_host}/apiservices/reference/v1.0/countries'\
.format(api_host=API_HOST)
LOCATION_AUTOSUGGEST_URL = '{api_host}/apiservices/autosuggest/v1.0'\
Expand All @@ -92,7 +93,7 @@ def __init__(self, api_key, response_format='json'):
if response_format.lower() not in self._SUPPORTED_FORMATS:
raise ValueError(
'Unknown response format: {}'.format(response_format) +
', supported formats are '.format(
+ ', supported formats are '.format(
', '.join(self._SUPPORTED_FORMATS)
)
)
Expand Down Expand Up @@ -202,7 +203,7 @@ def make_request(self, service_url, method='get', headers=None, data=None,
def get_markets(self, market):
"""
Get the list of markets
http://business.skyscanner.net/portal/en-GB/Documentation/Markets
https://business.skyscanner.net/portal/en-GB/Documentation/Markets
"""
url = "{url}/{market}".format(url=self.MARKET_SERVICE_URL,
market=market)
Expand All @@ -213,13 +214,13 @@ def location_autosuggest(self, **params):
Location Autosuggest Services
Doc URLs:
http://business.skyscanner.net/portal/en-GB/
https://business.skyscanner.net/portal/en-GB/
Documentation/Autosuggest
http://business.skyscanner.net/portal/en-GB/
https://business.skyscanner.net/portal/en-GB/
Documentation/CarHireAutoSuggest
http://business.skyscanner.net/portal/en-GB/
https://business.skyscanner.net/portal/en-GB/
Documentation/HotelsAutoSuggest
Format:
Expand Down Expand Up @@ -424,7 +425,7 @@ class Flights(Transport):
Flights Live Pricing
Please see:
http://business.skyscanner.net/portal/en-GB/
https://business.skyscanner.net/portal/en-GB/
Documentation/FlightsLivePricingList
"""

Expand Down Expand Up @@ -465,7 +466,7 @@ class FlightsCache(Flights):
Flights Browse Cache
Please see:
http://business.skyscanner.net/portal/en-GB/
https://business.skyscanner.net/portal/en-GB/
Documentation/FlightsBrowseCacheOverview
"""

Expand Down
Loading

0 comments on commit 9a9d561

Please sign in to comment.