Skip to content

Latest commit

 

History

History
100 lines (69 loc) · 2.31 KB

README.rst

File metadata and controls

100 lines (69 loc) · 2.31 KB

Memair Python SDK

image

image

image

Overview

SDK for simple interaction with the Memair APIs

Interactive Notebook

Explore this package in an Interactive Notebook

image

Hosted by binder

Installation

memair is available on PyPI

http://pypi.python.org/pypi/memair

Install via pip :

$ pip install memair

Or via easy_install :

$ easy_install memair

Or directly from memair's git repo :

$ git clone git://github.com/memair/memair-python-sdk.git
$ cd memair
$ python setup.py install

Basic usage

Generate a temporary access token

Validate GraphQL with GraphiQL

>>> from memair import Memair
>>> api_key = '0000000000000000000000000000000000000000000000000000000000000000'
>>> user = Memair(api_key)
>>> latest_location = user.query('''
        {
            Locations(first: 1, order: timestamp_desc) {
            lat
            lon
            timestamp
          }
        }
    ''')
>>> latest_location['data']['Locations'][0]
{'lat': 42.909056, 'lon': -74.572508, 'timestamp': '2018-07-27T22:27:21Z'}

Memair DNS tools

This package also includes a method to check if Memair DNS is blocked on specific dates

>>> from memair import is_dns_blocked
>>> from datetime import date
>>> is_dns_blocked(date(2019,1,9))
True
>>> is_dns_blocked(date(2019,1,10))
False

Running Test

$ python tests.py

Python compatibility

Developed for Python 3. May work but not tested in Python 2.