Skip to main content

用于 Memair 的 SDK

项目描述

https://badge.fury.io/py/memair.svg http://img.shields.io/badge/license-MIT-yellow.svg?style=flat https://img.shields.io/badge/contact-Gregology-blue.svg?style=flat

概述

用于与 Memair API 进行简单交互的 SDK

交互式笔记本

在交互式笔记本中探索这个包

https://user-images.githubusercontent.com/1595448/47387817-6b88a080-d6de-11e8-822d-ddd4f83fbd9b.png

由活页夹主持

安装

memair在 PyPI 上可用

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

通过pip安装

$ pip install memair

或通过easy_install

$ easy_install memair

或者直接从memairgit repo

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

基本用法

生成临时访问令牌

使用 GraphiQL 验证 GraphQL

>>> 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 工具

该软件包还包括一种检查 Memair DNS 是否在特定日期被阻止的方法。

>>> 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

运行测试

$ python tests.py

Python 兼容性

为 Python 3 开发。可能工作,但未在 Python 2 中测试。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

memair-0.2.1.tar.gz (3.2 kB 查看哈希)

已上传 source