本文整理汇总了Python中tweepy.utils.convert_to_utf8_str函数的典型用法代码示例。如果您正苦于以下问题:Python convert_to_utf8_str函数的具体用法?Python convert_to_utf8_str怎么用?Python convert_to_utf8_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convert_to_utf8_str函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_parameters
def build_parameters(self, args, kargs):
self.parameters = {}
for idx, arg in enumerate(args):
try:
self.parameters[self.allowed_param[idx]] = convert_to_utf8_str(arg)
except IndexError:
raise TweepError("Too many parameters supplied!")
for k, arg in kargs.items():
if arg is None:
continue
if k in self.parameters:
raise TweepError("Multiple values for parameter %s supplied!" % k)
self.parameters[k] = convert_to_utf8_str(arg)
示例2: build_parameters
def build_parameters(self, args, kwargs):
self.session.params = {}
for idx, arg in enumerate(args):
if arg is None:
continue
try:
self.session.params[self.allowed_param[idx]] = convert_to_utf8_str(arg)
except IndexError:
raise TweepError('Too many parameters supplied!')
for k, arg in kwargs.items():
if arg is None:
continue
if k in self.session.params:
raise TweepError('Multiple values for parameter %s supplied!' % k)
self.session.params[k] = convert_to_utf8_str(arg)
log.info("PARAMS: %r", self.session.params)
示例3: build_parameters
def build_parameters(self, args, kargs):
self.parameters = {}
for idx, arg in enumerate(args):
try:
self.parameters[self.allowed_param[idx]] = convert_to_utf8_str(arg)
except IndexError:
raise TweepError('Too many parameters supplied!')
for k, arg in kargs.items():
if arg is None:
continue
if k in self.parameters:
raise TweepError('Multiple values for parameter %s supplied!' % k)
self.parameters[k] = convert_to_utf8_str(arg)
# Set 'user' paramter to the authenticated user's name
# if no 'user' parameter value provided
if(self.api.auth and 'user' not in self.parameters):
self.parameters['user'] = self.api.auth.get_username()
示例4: build_parameters
def build_parameters(self, args, kargs):
self.parameters = {}
for idx, arg in enumerate(args):
if arg is None:
continue
try:
self.parameters[self.allowed_param[idx]] = convert_to_utf8_str(arg)
except IndexError:
raise TweepError("Too many parameters supplied!")
for k, arg in kargs.items():
if arg is None:
continue
if k in deprecated_params:
warnings.warn("The use of parameter %s is deprecated" % k, DeprecationWarning)
if deprecated_params[k] is None:
continue
k = deprecated_params[k]
if k in self.parameters:
raise TweepError("Multiple values for parameter %s supplied!" % k)
self.parameters[k] = convert_to_utf8_str(arg)
示例5: bulk_load
def bulk_load(listkey, tweets):
with open("/home/marcua/data/tweets/%s" % (listkey), "w") as tmpfile:
print "file %s" % (tmpfile.name)
for jsontweet in tweets:
tweet = Status.parse(api, json.loads(jsontweet))
tmpfile.write(convert_to_utf8_str(tweet.text) + "\n")
示例6: gen_tuple
def gen_tuple(jsontweet):
tweet = Status.parse(api, json.loads(jsontweet))
retweeted = (getattr(tweet, 'retweeted_status', None) != None)
return (tweet.author.id, tweet.created_at, convert_to_utf8_str(tweet.text), retweeted)