Skip to main content

Python library for GNIP.

Project description

gnippy provides an easy way to access the Power Track stream provided by GNIP.

Installation:

pip install gnippy

Quickstart:

#!/usr/bin/env python
import time
from gnippy import PowerTrackClient

# Define a callback
def callback(activity):
    print activity

# Create the client
url = "http://my.gnip.powertrack/url.json"
auth = ('MyUserName', 'MyPassword')
client = PowerTrackClient(callback, url=url, auth=auth)
client.connect()

# Wait for 2 minutes and then disconnect
time.sleep(120)
client.disconnect()

If no credentials/url is/are provided, gnippy will look for a boto-style .gnippy file in the user’s home directory. The structure of a .gnippy file is as follows:

[Credentials]
username = user@company.com
password = mypassword

[PowerTrack]
url = https://my.gnip.powertrack/url.json

This file can be stored in an alternate location and be passed in as a parameter to the constructor.

client = PowerTrackClient(callback) # if you have a ~/.gnippy file ready to rock
# OR
client = PowerTrackClient(callback, config_file_path="/etc/gnippy")

Source available on GitHub: http://github.com/abh1nav/gnippy/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gnippy-0.2.0.tar.gz (3.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page