def _get_method(self, url, param, typ, authentification=True): req = oauth.oauth_request(oauth=self._api_oauth, url=url, method='GET', params=param, authentification=authentification) try: #print 'DATA: %s' % req.get_data() #print 'METHOD: %s' % req.get_method() #print 'HOST: %s' % req.get_host() #print 'URL: %s' % req.get_full_url() #print 'HEADER: %s' % req.get_header('Authorization') #print "Error: %s" % e res = urllib2.urlopen(req) content = res.read() return self._type_parser(content, typ) except urllib2.HTTPError, e: print e.read()
def get_user_stream(): req = oauth.oauth_request(oauth=self._api_oauth, url=_USER_STREAM_URL, method='GET', params={}, authentification=True) return urllib2.urlopen(req, timeout=90.0)