Skip to main content

An asynchronous Wrapper around Google's QPX Express API

Project description

Documentation Status Build Status

A Python Wrapper around the Google QPX Flights API that supports both synchronous and asynchronous operation.


  • Fully asynchronous using aiohttp, or synchronous using requests.
  • Easy control over the formatting of requests and results
  • Powerful functions to work with API results


pip3 install pyflight

A Google API Key is required. You can obtain one at the Google API Dev Console.


Find flights from San Francisco (SFO) to Los Angeles (LAX), limited to one solution

We create a request and set the adult count, then add a slice to send with the request. We execute the API call synchronously and specify that we do not want to use the supplied containers and would like to receive the “raw” JSON response instead, to write the response to a file using Python’s built-in json module. Note that asynchronous API calls are designed to be used within asynchronous applications, thus we use a synchronous request here.

import json
import pyflight


flight = pyflight.Request()
flight.adult_count = 1


result = flight.send_sync(use_containers=False)

with open('res.json', 'w+') as f:
    json.dump(result, f)


  • Python 3.5+
  • aiohttp
  • requests


If you’re interested in running the tests, run python3 -m pytest. If required files for testing are not found in the directory, they will be downloaded automatically and saved for the next testing runs. You can also use the -v flag to enable a more detailed overview of the tests.


pyflight is not endorsed by Google and does not reflect the views or opinions of Google.

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pyflight-0.1.3.tar.gz (17.0 kB) Copy SHA256 hash SHA256 Source None Aug 3, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page