本文整理汇总了Python中tweepy.utils.urlencode_noplus函数的典型用法代码示例。如果您正苦于以下问题:Python urlencode_noplus函数的具体用法?Python urlencode_noplus怎么用?Python urlencode_noplus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了urlencode_noplus函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: len
if follow:
encoded_follow = [s.encode(encoding) for s in follow]
self.session.params['follow'] = ','.join(encoded_follow)
if track:
encoded_track = [s.encode(encoding) for s in track]
self.session.params['track'] = ','.join(encoded_track)
if locations and len(locations) > 0:
if len(locations) % 4 != 0:
raise TweepError("Wrong number of locations points, "
"it has to be a multiple of 4")
self.session.params['locations'] = ','.join(['%.4f' % l for l in locations])
if stall_warnings:
self.session.params['stall_warnings'] = stall_warnings
if languages:
self.session.params['language'] = ','.join(map(str, languages))
self.body = urlencode_noplus(self.session.params)
self.session.params['delimited'] = 'length'
self.host = 'stream.twitter.com'
self._start(async)
def sitestream(self, follow, stall_warnings=False, with_='user', replies=False, async=False):
self.parameters = {}
if self.running:
raise TweepError('Stream object already connected!')
self.url = '/%s/site.json' % STREAM_VERSION
self.parameters['follow'] = ','.join(map(str, follow))
self.parameters['delimited'] = 'length'
if stall_warnings:
self.parameters['stall_warnings'] = stall_warnings
if with_:
self.parameters['with'] = with_
开发者ID:Ignalion,项目名称:tweepy,代码行数:31,代码来源:streaming.py
示例2: TweepError
raise TweepError('Stream object already connected!')
self.url = '/%s/statuses/filter.json?delimited=length' % STREAM_VERSION
if follow:
self.parameters['follow'] = ','.join(map(str, follow))
if track:
self.parameters['track'] = ','.join(map(str, track))
if locations and len(locations) > 0:
assert len(locations) % 4 == 0
self.parameters['locations'] = ','.join(['%.2f' % l for l in locations])
if count:
self.parameters['count'] = count
if stall_warnings:
self.parameters['stall_warnings'] = stall_warnings
if languages:
self.parameters['language'] = ','.join(map(str, languages))
self.body = urlencode_noplus(self.parameters)
self.parameters['delimited'] = 'length'
self._start(async)
def disconnect(self):
if self.running is False:
return
self.running = False
def follow(self, follow, async=False):
if self.running:
raise TweepError('Stream object already connected!')
self.scheme = "https"
self.parameters = {}
self.headers['Content-type'] = "application/x-www-form-urlencoded"
开发者ID:varonicus,项目名称:tweepy,代码行数:31,代码来源:streaming.py
注:本文中的tweepy.utils.urlencode_noplus函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论