Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brightforme/python-gnip
https://github.com/brightforme/python-gnip
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/brightforme/python-gnip
- Owner: brightforme
- License: mit
- Created: 2016-08-02T14:05:06.000Z (over 8 years ago)
- Default Branch: develop
- Last Pushed: 2016-12-06T15:53:00.000Z (about 8 years ago)
- Last Synced: 2024-07-15T15:38:10.525Z (5 months ago)
- Language: Python
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
- Authors: AUTHORS.rst
Awesome Lists containing this project
README
python-gnip
=============Gnip PowerTrack Wrapper
Installation
------------Method with pip: if you have pip installed, just type this in a terminal
(sudo is optional on some systems)::
pip install python-gnip
Method by hand: download the sources, either on PyPI or (if you want the
development version) on Github, unzip everything in one folder, open a
terminal and type::
python setup.py install
Usage
-----Rules
~~~~~.. code:: python
from gnip import Gnip
g = Gnip(YOUR_ACCOUNT_NAME,
login=YOUR_EMAIL,
password=YOUR_PASSWORD
source="twitter"
)
print(g.get_rules())Add and Delete rules
````````````````````.. code:: python
from gnip import Gnip
g = Gnip(YOUR_ACCOUNT_NAME,
login=YOUR_EMAIL,
password=YOUR_PASSWORD
source="twitter"
)
# Add 2 rules
g.add_rules([{"value":"rule1","tag":"tag1"}, {"value":"rule2"}])
# Delete 2 rules
g.delete_rules([{"value":"rule1","tag":"tag1"}, {"value":"rule2"}])Stream
~~~~~~.. code:: python
from gnip import Gnip
g = Gnip(YOUR_ACCOUNT_NAME,
login=YOUR_EMAIL,
password=YOUR_PASSWORD
)
s = g.connect_stream()
for line in s.iter_lines():
if line:
print(line)