Пример #1
0
 def __init__(self):
     self.json_lib = import_simplejson()
Пример #2
0
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.

import sys
from socket import timeout
from threading import Thread
from time import sleep
import urllib2

from tweepy2.models import Status
from tweepy2.api import API
from tweepy2.error import TweepError

from tweepy2.utils import import_simplejson, urlencode_noplus
json = import_simplejson()

STREAM_VERSION = 1


class StreamListener(object):

    def __init__(self, api=None):
        self.api = api or API()

    def on_data(self, data):
        """Called when raw data is received from connection.

        Override this method if you wish to manually handle
        the stream data. Return False to stop stream and close connection.
        """
Пример #3
0
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.

import httplib
from socket import timeout
from threading import Thread
from time import sleep

from tweepy2.models import Status
from tweepy2.api import API
from tweepy2.error import TweepError

from tweepy2.utils import import_simplejson, urlencode_noplus
json = import_simplejson()

STREAM_VERSION = '1.1'


class StreamListener(object):
    def __init__(self, api=None):
        self.api = api or API()

    def on_data(self, data):
        """Called when raw data is received from connection.

        Override this method if you wish to manually handle
        the stream data. Return False to stop stream and close connection.
        """

        if 'in_reply_to_status_id' in data:
Пример #4
0
 def __init__(self):
     self.json_lib = import_simplejson()