GithubHelp home page GithubHelp logo

woozyking / datasift-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from meltwaterarchive/datasift-python

0.0 1.0 0.0 189 KB

Python client to interface with DataSift

Home Page: http://datasift.com/

License: MIT License

Python 99.94% Shell 0.06%

datasift-python's Introduction

DataSift Python Client Library

This is the official Python library for accessing Datasift. See the examples folder for some simple example usage.

All examples and tests use the username and API key in config.py.

Installation

The simplest way...

easy_install datasift

From source...

python setup.py install

Simple example

This example looks for anything that contains the word "datasift" and simply prints the content to the screen as they come in.

import sys, os, config, datasift

class EventHandler(datasift.StreamConsumerEventHandler):
  def on_interaction(self, consumer, data, hash):
    print data['interaction']['content']
  def on_warning(self, consumer, message):
    print 'WARN: %s' % (message)
  def on_error(self, consumer, message):
    print 'ERR: %s' % (message)

user = datasift.User(config.username, config.api_key)
definition = user.create_definition('interaction.content contains "datasift"')
consumer = definition.get_consumer(EventHandler(), 'http')
consumer.consume()
consumer.run_forever()

See the DataSift documentation for full details of the data contained within each interaction. See this page on our developer site for an example tweet: http://dev.datasift.com/docs/targets/twitter/tweet-output-format

The library will use SSL connections by default. While we recommend using SSL you may disable it if required by passing False as the third parameter when creating a user, or by calling enable_ssl(False) on the user object.

Requirements

  • Python 2.4+

License

All code contained in this repository is Copyright 2012 MediaSift Ltd.

This code is released under the BSD license. Please see the LICENSE file for more details.

Changelog

  • v.0.5.7 Fixed issues with buffers on reconnections (2013-06-28)

  • v.0.5.6 Fixed broken tests, multistreaming, reconnection timeout (2013-05-03)

  • v.0.5.5 Introduced automatic reconnection after 65 seconds of no data or ticks. Solves 'silent disconnect' issue (2013-03-06)

  • v.0.5.4 Removed checks for existance of deprecated 'volume_info' field in historics/prepare response (2013-01-18)

  • v.0.5.3 Added missing Historic sample size into historic/prepare requests (2012-12-03)

  • v.0.5.2 Patch for the missing availability info after Historic/prepare woozyking (2012-11-28)

  • v.0.5.1 Removed unit tests that are no longer required (2012-08-30)

  • v.0.5.0 Added support for Historic queries and Push delivery (2012-08-27)

  • v.0.4.0 Fixed issues with SSL timeouts & low throughput streams (2012-08-08)

  • v.0.3.0 Added SSL support and fixed a reconnection bug (2012-05-16)

    The SSL support is enabled by default and can be disabled by passing false as the third parameter to the User constructor, or calling enableSSL(false) on the User object.

  • v.0.2.0 Fixed the handling of error messages in streams (2012-05-04)

  • v.0.1.1 Initial release (2012-03-09)


datasift-python's People

Contributors

arraypad avatar badmetacoder avatar dugjason avatar pbutler avatar quipo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.