Welcome to Skyscanner PHP SDK’s documentation!¶
Contents:
Skyscanner PHP SDK¶
Skyscanner PHP SDK for Skyscanner’s API
- Free software: Apache 2.0 license
- SDK Documentation: https://skyscanner-php.readthedocs.org.
- API Documentation: http://business.skyscanner.net/portal/en-GB/Documentation/ApiOverview
Features¶
- Tested on PHP 5.4, 5.5, 5.6 and HHVM
- Supports Flights, Hotels, and Carhire
Installation¶
composer update
Running Tests¶
The recommended way of testing in your local machine is using Docker.
This package includes a docker-compose
file that is meant to run the unit tests on different PHP versions.
docker-compose run php54 phpunit
docker-compose run php55 phpunit
docker-compose run php56 phpunit
Installation¶
At the command line:
$ easy_install skyscanner
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv skyscanner
$ pip install skyscanner
Usage¶
To use Skyscanner Python SDK in a project, make sure that you set your API Key. For example:
from skyscanner import Flights
flights_service = Flights('<Your API Key>')
Flights: Live Pricing¶
http://business.skyscanner.net/portal/en-GB/Documentation/FlightsLivePricingList
Get live prices:
from 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='2015-05-28',
inbounddate='2015-05-31',
adults=1)
Flights: Browse Cache¶
http://business.skyscanner.net/portal/en-GB/Documentation/FlightsBrowseCacheOverview
Cheapest quotes:
from skyscanner import FlightsCache
flights_cache_service = FlightsCache('<Your API Key>')
result = flights_cache_service.get_cheapest_quotes(
country='UK',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2015-05',
inbounddate='2015-06')
Cheapest price by route:
from skyscanner import FlightsCache
flights_cache_service = FlightsCache('<Your API Key>')
result = flights_cache_service.get_cheapest_price_by_route(
country='UK',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2015-05',
inbounddate='2015-06')
Cheapest price by date:
from skyscanner import FlightsCache
flights_cache_service = FlightsCache('<Your API Key>')
result = flights_cache_service.get_cheapest_price_by_date(
country='UK',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2015-05',
inbounddate='2015-06')
Grid of prices by date:
from skyscanner import FlightsCache
flights_cache_service = FlightsCache('<Your API Key>')
result = flights_cache_service.get_grid_prices_by_date(
country='UK',
currency='GBP',
locale='en-GB',
originplace='SIN-sky',
destinationplace='KUL-sky',
outbounddate='2015-05',
inbounddate='2015-06')
Car Hire¶
http://business.skyscanner.net/portal/en-GB/Documentation/CarHireLivePricing
Get live prices:
from 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='2015-05-29T12:00',
dropoffdatetime='2015-05-29T18:00',
driverage='30',
userip='175.156.244.174')
Car hire autosuggest:
from skyscanner import CarHire
carhire_service = CarHire('<Your API Key>')
result = carhire_service.location_autosuggest(
market='UK',
currency='GBP',
locale='en-GB',
query='Kuala')
Hotels¶
http://business.skyscanner.net/portal/en-GB/Documentation/HotelsOverview
Hotels autosuggest:
from skyscanner import Hotels
hotels_service = Hotels('<Your API Key>')
result = hotels_service.location_autosuggest(
market='UK',
currency='GBP',
locale='en-GB',
query='Kuala')
Hotels prices and details:
from skyscanner import Hotels
hotels_service = Hotels(self.api_key)
result = hotels_service.get_result(
market='UK',
currency='GBP',
locale='en-GB',
entityid=27543923,
checkindate='2015-05-26',
checkoutdate='2015-05-30',
guests=1,
rooms=1)
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/Skyscanner/skyscanner-python-sdk/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
Skyscanner Python SDK could always use more documentation, whether as part of the official Skyscanner Python SDK docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/Skyscanner/skyscanner-python-sdk/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up skyscanner for local development.
Fork the skyscanner repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/skyscanner-python-sdk.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv skyscanner $ cd skyscanner/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 skyscanner tests $ python setup.py test $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, 3.3, and 3.4, and for PyPy. Check https://travis-ci.org/Skyscanner/skyscanner-python-sdk/pull_requests and make sure that the tests pass for all supported Python versions.
Credits¶
Development Lead¶
- Ardy Dedase <ardy.dedase@skyscanner.net>
Contributors¶
- Denis Dudnik <deniska.dudnik@gmail.com>
- Amado Martinez <amado@projectivemotion.com>
History¶
1.0.0 (2015-03-24)¶
- First release on PyPI.
1.1.0 (2015-07-18)¶
- Stable release on PyPI.