memair的sdk
memair的Python项目详细描述
概述
与memair api进行简单交互的sdk
安装
memair在pypi上可用
http://pypi.python.org/pypi/memair
通过pip
安装$ pip install memair
或通过easy_install
$ easy_install memair
或者直接从memair'sgit repo
$ git clone git://github.com/memair/memair-python-sdk.git $ cd memair $ python setup.py install
基本用法
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工具
这个包还包括一个检查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兼容性
为Python3开发。可以工作,但不能在python 2中测试。