本文整理汇总了Python中tweepy.utils.list_to_csv函数的典型用法代码示例。如果您正苦于以下问题:Python list_to_csv函数的具体用法?Python list_to_csv怎么用?Python list_to_csv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了list_to_csv函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove_list_members
def remove_list_members(self, screen_name=None, user_id=None, slug=None,
list_id=None, owner_id=None, owner_screen_name=None):
""" Perform bulk remove of list members from user ID or screenname """
return self._remove_list_members(list_to_csv(screen_name),
list_to_csv(user_id),
slug, list_id, owner_id,
owner_screen_name)
示例2: lookup_users
def lookup_users(self, user_ids=None, screen_names=None, include_entities=None):
""" Perform bulk look up of users from user ID or screenname """
post_data = {}
if include_entities is not None:
include_entities = "true" if include_entities else "false"
post_data["include_entities"] = include_entities
if user_ids:
post_data["user_id"] = list_to_csv(user_ids)
if screen_names:
post_data["screen_name"] = list_to_csv(screen_names)
return self._lookup_users(post_data=post_data)
示例3: _lookup_users
def _lookup_users(self, user_ids=[], screen_names=[]):
'''A wrapper around __uncached_lookup_users to store the returned Users
in the cache'''
try:
users = self.__uncached_lookup_users(list_to_csv(user_ids), list_to_csv(screen_names))
self.cache.store_users(*users)
return users
except TweepError, e:
# We looked for a user that does not exist
if 'page does not exist' in e.reason:
return []
raise
示例4: update_status
def update_status(self, *args, **kwargs):
""" :reference: https://dev.twitter.com/rest/reference/post/statuses/update
:allowed_param:'status', 'in_reply_to_status_id', 'in_reply_to_status_id_str', 'lat', 'long', 'source', 'place_id', 'display_coordinates', 'media_ids'
"""
post_data = {}
media_ids = kwargs.pop("media_ids", None)
if media_ids is not None:
post_data["media_ids"] = list_to_csv(media_ids)
return bind_api(
api=self,
path="/statuses/update.json",
method="POST",
payload_type="status",
allowed_param=[
"status",
"in_reply_to_status_id",
"in_reply_to_status_id_str",
"lat",
"long",
"source",
"place_id",
"display_coordinates",
],
require_auth=True,
)(post_data=post_data, *args, **kwargs)
示例5: remove_list_members
def remove_list_members(self, screen_names=[], user_ids=[],
owner_screen_name=None, owner_id=None, slug=None, list_id=None):
if not isinstance(screen_names, list) or not isinstance(user_ids, list):
raise TweepError('screen_names and user_ids must be list object')
# Note:
# Twitter API document says "up to 100 are allowed in a single request."
# But request with 100 user IDs or screen names are always failed for over capacity.
# So their limit is set to 50.
if len(screen_names) > 50 or len(user_ids) > 50:
raise TweepError('Length of screen_names or user_ids must be up to 50')
return self._remove_list_members(
list_to_csv(screen_names),
list_to_csv(user_ids),
owner_screen_name = owner_screen_name,
owner_id = owner_id,
slug = slug,
list_id = list_id)
示例6: update_status
def update_status(self, media_ids=None, *args, **kwargs):
""" :reference: https://dev.twitter.com/rest/reference/post/statuses/update
:allowed_param:'status', 'in_reply_to_status_id', 'lat', 'long', 'source', 'place_id', 'display_coordinates', 'media_ids'
"""
post_data = {}
if media_ids is not None:
post_data["media_ids"] = list_to_csv(media_ids)
return bind_api(
api=self,
path='/statuses/update.json',
method='POST',
payload_type='status',
allowed_param=['status', 'in_reply_to_status_id', 'lat', 'long', 'source', 'place_id', 'display_coordinates'],
require_auth=True
)(post_data=post_data, *args, **kwargs)
示例7: lookup_users
def lookup_users(self, user_ids=None, screen_names=None):
return self._lookup_users(list_to_csv(user_ids), list_to_csv(screen_names))
示例8: statuses_lookup
def statuses_lookup(self, id_, include_entities=None, trim_user=None, map_=None):
return self._statuses_lookup(list_to_csv(id_), include_entities,
trim_user, map_)
示例9: lookup_friendships
def lookup_friendships(self, user_ids=None, screen_names=None):
""" Perform bulk look up of friendships from user ID or screenname """
return self._lookup_friendships(list_to_csv(user_ids), list_to_csv(screen_names))
示例10: lookup_statuses
def lookup_statuses(self, status_ids=None):
return self._lookup_statuses(list_to_csv(status_ids))
示例11: remove_list_members
def remove_list_members(self, screen_name=None, user_id=None, slug=None,
list_id=None, owner_id=None, owner_screen_name=None):
return self._remove_list_members(list_to_csv(screen_name),
list_to_csv(user_id),
slug, list_id, owner_id,
owner_screen_name)
示例12: lookup_users
def lookup_users(self, user_ids=None, screen_names=None, include_entities=True):
return self._lookup_users(list_to_csv(user_ids), list_to_csv(screen_names), include_entities)