gnip的python库。
gnipp的Python项目详细描述
根据apache许可证2.0版(以下简称"许可证");
除非符合许可证,否则您不得使用此文件。
您可以在http://www.apache.org/licenses/license-2.0
http://www.apache.org/licenses/license-2.0
o以书面形式,根据许可证分发的软件是按"原样"分发的,
没有任何形式的保证或条件,无论是明示的还是默示的。
请参阅许可证,了解管理许可证的特定语言和许可证的限制。
d说明:gnippy:gnip的python库图片::https://badge.fury.io/py/gnippy.svg
:目标:https://pypi.python.org/pypi/gnippy
……图片::https://img.shields.io/pypi/dm/gnippy.svg
:目标:https://pypi.python.org/pypi/gnippy
…图片:https://travis-ci.org/abh1nav/gnippy.svg?branch=master
:target:https://travis ci.org/abh1nav/gnippy
gnippy提供了一种访问gnip提供的"power track"流的简单方法。还可以使用gnippy以编程方式向您添加规则。R电源线流。
安装
----
…代码块::python
quickstart
----
创建一个.gnippy文件并将其放在主目录中。它应该包含以下内容:
…代码块::text
[凭据]
用户名=user@company.com
密码=my password
[powertrack]
url=https://my.gnip.powertrack/url.json
规则URL=https://api.gnip.powertrack/rules.json
启动客户端:
…代码块::python
/usr/bin/env python
从gnippy导入powertrackclient
owertrackclient(回调)
client.connect()
不想创建配置文件或将其放在另一个位置:
…代码块::python
client=powertrackclient(回调,配置文件路径="/etc/gnippy")
提供URL和身份验证凭据以覆盖任何配置文件
client=powertrackclient(callback,url="http://my.gnip.powertrack/url.json",auth=("uname","pwd"))
…代码块:text
gnippy_url
gnippy_rules_url
gnippy_auth_username
gnippy_auth_password
---
如果要将"rules<;http://support.gnip.com/api/powertrack/rules.html>;``添加到Powertrack:
……代码块::python
from gnippy import rules
from gnippy.errors import ruleaddfailedexception
或world或"这是一个测试")lang:en',tag="myrule")
规则。添加规则('rule without a tag')
除了ruleaddfailedexception:
通过
一次同步添加多个规则
rule\u list=[]
rule\u list.append(rules.build("hello world",tag="asdf"))
rule\u list.append(rules.build("rule without a tag"))
尝试:
规则。添加规则(rule\u list)
,ruleaddfailedexception除外:
pass
或…手动传入参数-重写任何配置文件
规则。添加规则("我的规则字符串",tag="mytag",rules_url="https://api.gnip.powertrack/rules.json",\
auth=("uname","pwd"))
列出活动的powertrack规则
…代码块::python
from gnippy import rules
from gnippy.errors import rules getfailedexception
try:
rules_list=rules.get_rules()
rules_list格式为:
[
{"value":(你好或世界)和lang:en"},
{"value":"hello","tag":"mytag"}
{br/>
除了rulesgetfailedexception:
pass
deleting powertrack rules
——
……代码块::python
from gnippy import rules
from gnippy.errors import ruledeletefiledexception,rulesgetfailedexception
try:
rules\u list=rules.get\rules()
删除规则(规则列表[0])
或…我要删除所有规则。删除规则(规则列表)
除非符合许可证,否则您不得使用此文件。
您可以在http://www.apache.org/licenses/license-2.0
http://www.apache.org/licenses/license-2.0
o以书面形式,根据许可证分发的软件是按"原样"分发的,
没有任何形式的保证或条件,无论是明示的还是默示的。
请参阅许可证,了解管理许可证的特定语言和许可证的限制。
d说明:gnippy:gnip的python库图片::https://badge.fury.io/py/gnippy.svg
:目标:https://pypi.python.org/pypi/gnippy
……图片::https://img.shields.io/pypi/dm/gnippy.svg
:目标:https://pypi.python.org/pypi/gnippy
…图片:https://travis-ci.org/abh1nav/gnippy.svg?branch=master
:target:https://travis ci.org/abh1nav/gnippy
gnippy提供了一种访问gnip提供的"power track"流的简单方法。还可以使用gnippy以编程方式向您添加规则。R电源线流。
安装
----
…代码块::python
quickstart
----
创建一个.gnippy文件并将其放在主目录中。它应该包含以下内容:
…代码块::text
[凭据]
用户名=user@company.com
密码=my password
[powertrack]
url=https://my.gnip.powertrack/url.json
规则URL=https://api.gnip.powertrack/rules.json
启动客户端:
…代码块::python
/usr/bin/env python
从gnippy导入powertrackclient
owertrackclient(回调)
client.connect()
不想创建配置文件或将其放在另一个位置:
…代码块::python
client=powertrackclient(回调,配置文件路径="/etc/gnippy")
提供URL和身份验证凭据以覆盖任何配置文件
client=powertrackclient(callback,url="http://my.gnip.powertrack/url.json",auth=("uname","pwd"))
…代码块:text
gnippy_url
gnippy_rules_url
gnippy_auth_username
gnippy_auth_password
---
如果要将"rules<;http://support.gnip.com/api/powertrack/rules.html>;``添加到Powertrack:
……代码块::python
from gnippy import rules
from gnippy.errors import ruleaddfailedexception
或world或"这是一个测试")lang:en',tag="myrule")
规则。添加规则('rule without a tag')
除了ruleaddfailedexception:
通过
一次同步添加多个规则
rule\u list=[]
rule\u list.append(rules.build("hello world",tag="asdf"))
rule\u list.append(rules.build("rule without a tag"))
尝试:
规则。添加规则(rule\u list)
,ruleaddfailedexception除外:
pass
或…手动传入参数-重写任何配置文件
规则。添加规则("我的规则字符串",tag="mytag",rules_url="https://api.gnip.powertrack/rules.json",\
auth=("uname","pwd"))
列出活动的powertrack规则
…代码块::python
from gnippy import rules
from gnippy.errors import rules getfailedexception
try:
rules_list=rules.get_rules()
rules_list格式为:
[
{"value":(你好或世界)和lang:en"},
{"value":"hello","tag":"mytag"}
{br/>
除了rulesgetfailedexception:
pass
deleting powertrack rules
——
……代码块::python
from gnippy import rules
from gnippy.errors import ruledeletefiledexception,rulesgetfailedexception
try:
rules\u list=rules.get\rules()
删除规则(规则列表[0])
或…我要删除所有规则。删除规则(规则列表)