Coder Social home page Coder Social logo

gapi-python's Introduction

DEPRECATED IN FAVOUR OF gapipy

gapi-python is a simple Python client for the G Adventures API. It provides Python object mapping for methods to save, update and delete objects, as well as an interface for querying stored objects.

Usage

You'll need to provide your G Adventures API Application Key. This is available from your G Adventures API Dashboard

>>> import gapipy as gapi
>>> gapi.APPLICATION_KEY = 'your application_key'

Query for a list of resources:

>>> query = gapi.Query('tours')
>>> query.fetch()

Get a single resource:

>>> gapi.Query('tours').get(9649)

Query a list of resources via a parent criteria. This takes advantage of a helpful feature in the API which makes it easy to query for related resources.

>>> gapi.Query('departures').parent('tours', 9649).fetch()

Saving Objects

Currently, as the G Adventures API only supports reading, there is no notion of updating and creating within this client.

Filtering Resources

You are able to filter resources based on some simple operators.

For instance, simple equality checks:

>>> gapi.Query('dossiers').eq('dossier_code', 'PPP')

Chaining is of course, allowed for multiple equality checks..

Advanced Usage

Although it will be very rare that you change API_ROOT, unless you're hosting your own API layer, it can be common for you to adjust API_PROXY. By changing this variable, all links returned by the API will be relative to API_PROXY

Dependencies

Develop

Run tests:

pip install nose mock
nosetests

Then work your magic!

gapi-python's People

Contributors

bartek avatar silent1mezzo avatar nagyman avatar coalpaw avatar rafikdraoui avatar

Watchers

 avatar Terence Lo avatar  avatar Ivan Djokic avatar Andrew Gardner avatar James Cloos avatar Subodh M Bahl avatar  avatar Ken Lalonde avatar Neeraj Singh avatar Les Liddell avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.