コード例 #1
0
ファイル: streaming.py プロジェクト: alphachoi/Pandora
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.

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

from weibo.weibopy.auth import BasicAuthHandler
from weibo.weibopy.models import Status
from weibo.weibopy.api import API
from weibo.weibopy.error import WeibopError

from weibo.weibopy.utils import import_simplejson
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.
        """
コード例 #2
0
ファイル: parsers.py プロジェクト: alphachoi/Pandora
 def __init__(self):
     self.json_lib = import_simplejson()
コード例 #3
0
 def __init__(self):
     self.json_lib = import_simplejson()
コード例 #4
0
ファイル: streaming.py プロジェクト: ceciet/Pandora
# See LICENSE for details.

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

from weibo.weibopy.auth import BasicAuthHandler
from weibo.weibopy.models import Status
from weibo.weibopy.api import API
from weibo.weibopy.error import WeibopError

from weibo.weibopy.utils import import_simplejson

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.
        """