本文整理汇总了Python中twython.Twython.get_list_subscriptions方法的典型用法代码示例。如果您正苦于以下问题:Python Twython.get_list_subscriptions方法的具体用法?Python Twython.get_list_subscriptions怎么用?Python Twython.get_list_subscriptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twython.Twython
的用法示例。
在下文中一共展示了Twython.get_list_subscriptions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TwythonAPITestCase
# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import get_list_subscriptions [as 别名]
#.........这里部分代码省略.........
# Multi add/delete members
self.api.create_list_members(list_id=list_id,
screen_name='johncena,xbox')
self.api.delete_list_members(list_id=list_id,
screen_name='johncena,xbox')
# Single add/delete member
self.api.add_list_member(list_id=list_id, screen_name='justinbieber')
self.api.delete_list_member(list_id=list_id, screen_name='justinbieber')
self.api.delete_list(list_id=list_id)
def test_get_list_memberships(self):
'''Test list of lists the authenticated user is a member of succeeds'''
self.api.get_list_memberships()
def test_get_list_subscribers(self):
'''Test list of subscribers of a specific list succeeds'''
self.api.get_list_subscribers(list_id=test_list_id)
def test_subscribe_is_subbed_and_unsubscribe_to_list(self):
'''Test subscribing, is a list sub and unsubbing to list succeeds'''
self.api.subscribe_to_list(list_id=test_list_id)
# Returns 404 if user is not a subscriber
self.api.is_list_subscriber(list_id=test_list_id,
screen_name=screen_name)
self.api.unsubscribe_from_list(list_id=test_list_id)
def test_is_list_member(self):
'''Test returning if specified user is member of a list succeeds'''
# Returns 404 if not list member
self.api.is_list_member(list_id=test_list_id, screen_name='jack')
def test_get_list_members(self):
'''Test listing members of the specified list succeeds'''
self.api.get_list_members(list_id=test_list_id)
def test_get_specific_list(self):
'''Test getting specific list succeeds'''
self.api.get_specific_list(list_id=test_list_id)
def test_get_list_subscriptions(self):
'''Test collection of the lists the specified user is
subscribed to succeeds'''
self.api.get_list_subscriptions(screen_name='twitter')
def test_show_owned_lists(self):
'''Test collection of lists the specified user owns succeeds'''
self.api.show_owned_lists(screen_name='twitter')
# Saved Searches
def test_get_saved_searches(self):
'''Test getting list of saved searches for authenticated
user succeeds'''
self.api.get_saved_searches()
def test_create_get_destroy_saved_search(self):
'''Test getting list of saved searches for authenticated
user succeeds'''
saved_search = self.api.create_saved_search(query='#Twitter')
saved_search_id = saved_search['id_str']
self.api.show_saved_search(id=saved_search_id)
self.api.destroy_saved_search(id=saved_search_id)
# Places & Geo
def test_get_geo_info(self):
'''Test getting info about a geo location succeeds'''
self.api.get_geo_info(place_id='df51dec6f4ee2b2c')
def test_reverse_geo_code(self):
'''Test reversing geocode succeeds'''
self.api.reverse_geocode(lat='37.76893497', long='-122.42284884')
def test_search_geo(self):
'''Test search for places that can be attached
to a statuses/update succeeds'''
self.api.search_geo(query='Toronto')
def test_get_similar_places(self):
'''Test locates places near the given coordinates which
are similar in name succeeds'''
self.api.get_similar_places(lat='37', long='-122', name='Twitter HQ')
# Trends
def test_get_place_trends(self):
'''Test getting the top 10 trending topics for a specific
WOEID succeeds'''
self.api.get_place_trends(id=1)
def test_get_available_trends(self):
'''Test returning locations that Twitter has trending
topic information for succeeds'''
self.api.get_available_trends()
def test_get_closest_trends(self):
'''Test getting the locations that Twitter has trending topic
information for, closest to a specified location succeeds'''
self.api.get_closest_trends(lat='37', long='-122')
示例2: Twitter
# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import get_list_subscriptions [as 别名]
#.........这里部分代码省略.........
def load_saved_searches(self):
searches = self.api_call('get_saved_searches', report_success=False)
if not searches:
return
s = ""
if len(searches) > 1:
s = 'es'
logging.info("Loading %d saved search%s from twitter." % (len(searches), s))
output.speak(_("Loading %d saved search%s from twitter.") % (len(searches), s))
for i in searches:
try:
buf = self.register_buffer(_("Search for %s") % i['query'], buffers.Search, store=True, term=i['query'], saved_id=i['id'], announce=False, set_focus=False)
except:
logging.exception("%s: Building buffer for saved search %s failed." % (self.name, i))
def retrieve_lists(self, user = None, include_subscribed = False):
if user is None:
user = self.username
output.speak(_("Retrieving lists"), True)
else:
output.speak(_("Retrieving lists for %s") % user, True)
lists = []
value = self.TwitterApi.show_lists(screen_name=user)
lists.extend(value)
if include_subscribed:
lists.extend(self.retrieve_subscribed_lists(user))
return lists
def retrieve_subscribed_lists(self, user = None):
lists = []
nextCursor = -1
while nextCursor:
value = self.TwitterApi.get_list_subscriptions(screen_name=user, cursor=nextCursor)
nextCursor = value['next_cursor']
lists.extend(value['lists'])
return lists
def load_lists (self):
all_lists = self.retrieve_lists()
if not all_lists:
return
s = ""
if len(all_lists) > 1:
s = 's'
logging.info("Retrieving %d list timeline%s from twitter." % (len(all_lists), s))
output.speak(_("Retrieving %d list timeline%s from twitter.") % (len(all_lists), s))
for i in all_lists:
try:
self.spawn_list_buffer(i, set_focus=False)
except:
logging.exception("Building buffer %s failed." % i)
def spawn_list_buffer(self, owner = None, which = None, set_focus=True):
self.register_buffer(_("List timeline for %s") % which['name'], buffers.ListTimeline, owner = owner, list=which, announce=True, set_focus=set_focus)
def show_configuration_dialog(self):
new = gui.configuration.TwitterConfigDialog(self, sessions.current_session.frame, wx.ID_ANY, config=self.config)
new.SetDefaultValues()
if new.ShowModal() != wx.ID_OK:
logging.debug("User canceled configuration. Exitting.")
return output.speak(_("Configuration canceled."), 1)
new.SetNewConfigValues()
with self.storage_lock:
self.config.update(new.config)
self.config['isConfigured'] = True
示例3: TwythonAPITestCase
# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import get_list_subscriptions [as 别名]
#.........这里部分代码省略.........
# Multi add/delete members
self.api.create_list_members(list_id=list_id,
screen_name=screen_names)
self.api.delete_list_members(list_id=list_id,
screen_name=screen_names)
# Single add/delete member
self.api.add_list_member(list_id=list_id, screen_name='justinbieber')
self.api.delete_list_member(list_id=list_id, screen_name='justinbieber')
self.api.delete_list(list_id=list_id)
def test_get_list_subscribers(self):
"""Test list of subscribers of a specific list succeeds"""
self.api.get_list_subscribers(list_id=test_list_id)
def test_subscribe_is_subbed_and_unsubscribe_to_list(self):
"""Test subscribing, is a list sub and unsubbing to list succeeds"""
self.api.subscribe_to_list(list_id=test_list_id)
# Returns 404 if user is not a subscriber
self.api.is_list_subscriber(list_id=test_list_id,
screen_name=screen_name)
self.api.unsubscribe_from_list(list_id=test_list_id)
def test_is_list_member(self):
"""Test returning if specified user is member of a list succeeds"""
# Returns 404 if not list member
self.api.is_list_member(list_id=test_list_id, screen_name='jack')
def test_get_list_members(self):
"""Test listing members of the specified list succeeds"""
self.api.get_list_members(list_id=test_list_id)
def test_get_specific_list(self):
"""Test getting specific list succeeds"""
self.api.get_specific_list(list_id=test_list_id)
def test_get_list_subscriptions(self):
"""Test collection of the lists the specified user is
subscribed to succeeds"""
self.api.get_list_subscriptions(screen_name='twitter')
def test_show_owned_lists(self):
"""Test collection of lists the specified user owns succeeds"""
self.api.show_owned_lists(screen_name='twitter')
# Saved Searches
def test_get_saved_searches(self):
"""Test getting list of saved searches for authenticated
user succeeds"""
self.api.get_saved_searches()
def test_create_get_destroy_saved_search(self):
"""Test getting list of saved searches for authenticated
user succeeds"""
saved_search = self.api.create_saved_search(query='#Twitter')
saved_search_id = saved_search['id_str']
self.api.show_saved_search(id=saved_search_id)
self.api.destroy_saved_search(id=saved_search_id)
# Places & Geo
def test_get_geo_info(self):
"""Test getting info about a geo location succeeds"""
self.api.get_geo_info(place_id='df51dec6f4ee2b2c')
def test_reverse_geo_code(self):
"""Test reversing geocode succeeds"""
self.api.reverse_geocode(lat='37.76893497', long='-122.42284884')
def test_search_geo(self):
"""Test search for places that can be attached
to a statuses/update succeeds"""
self.api.search_geo(query='Toronto')
def test_get_similar_places(self):
"""Test locates places near the given coordinates which
are similar in name succeeds"""
self.api.get_similar_places(lat='37', long='-122', name='Twitter HQ')
# Trends
def test_get_place_trends(self):
"""Test getting the top 10 trending topics for a specific
WOEID succeeds"""
self.api.get_place_trends(id=1)
def test_get_available_trends(self):
"""Test returning locations that Twitter has trending
topic information for succeeds"""
self.api.get_available_trends()
def test_get_closest_trends(self):
"""Test getting the locations that Twitter has trending topic
information for, closest to a specified location succeeds"""
self.api.get_closest_trends(lat='37', long='-122')
# Help
def test_get_application_rate_limit_status(self):
"""Test getting application rate limit status succeeds"""
self.oauth2_api.get_application_rate_limit_status()
示例4: TwitterHelper
# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import get_list_subscriptions [as 别名]
#.........这里部分代码省略.........
lyric += " " + hashtag
while lyric in lastlyrics:
lyric += random.choice(self.mutation)
lastlyrics.add(lyric)
self.identity.statistics.record_outgoing_song_lyric()
in_reply_to_id_str = self._send_to(
inbox_item,
lyric,
target,
in_reply_to_id_str)
time.sleep(5)
def _send_to(self, inbox_item, text, target, in_reply_to_id_str):
if inbox_item:
return self.reply_with(
inbox_item=inbox_item,
text=text,
in_reply_to_id_str=in_reply_to_id_str)
else:
status = ""
if target:
# noinspection PyUnresolvedReferences
if isinstance(target, basestring):
status = "[email protected]" + target
elif isinstance(target, User.User):
status = "[email protected]" + target.screen_name
status += " " + text
tweet = OutgoingTweet(
text=status,
in_reply_to_id_str=in_reply_to_id_str)
return self.send(tweet)
@retry(**retry_args)
def get_list_subscriptions(self):
return self.twitter.get_list_subscriptions()
@retry(**retry_args)
def subscribe_to_list(self, list_id):
return self.twitter.subscribe_to_list(list_id=list_id)
@retry(**retry_args)
def geocode(self, location):
result = self.twitter.search_geo(
query=location.full_name,
max_results=5,
lat=location.latitude,
long=location.longitude)
logger.info(result)
if result["result"]["places"]:
# for place in result["result"]["places"]:
# logger.info(place["full_name"])
place = result["result"]["places"][0]
location.place_id_twitter = place["id"]
return location
else:
return None
@retry(**retry_args)
def reverse_geocode(self, location):
result = self.twitter.reverse_geocode(
max_results=5,
示例5: TwythonEndpointsTestCase
# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import get_list_subscriptions [as 别名]
#.........这里部分代码省略.........
@unittest.skip('skipping non-updated test')
def test_subscribe_is_subbed_and_unsubscribe_to_list(self):
"""Test subscribing, is a list sub and unsubbing to list succeeds"""
self.api.subscribe_to_list(slug=test_list_slug,
owner_screen_name=test_list_owner_screen_name)
# Returns 404 if user is not a subscriber
self.api.is_list_subscriber(slug=test_list_slug,
owner_screen_name=test_list_owner_screen_name,
screen_name=screen_name)
self.api.unsubscribe_from_list(slug=test_list_slug,
owner_screen_name=test_list_owner_screen_name)
@unittest.skip('skipping non-updated test')
def test_is_list_member(self):
"""Test returning if specified user is member of a list succeeds"""
# Returns 404 if not list member
self.api.is_list_member(slug=test_list_slug,
owner_screen_name=test_list_owner_screen_name,
screen_name='themattharris')
@unittest.skip('skipping non-updated test')
def test_get_list_members(self):
"""Test listing members of the specified list succeeds"""
self.api.get_list_members(slug=test_list_slug,
owner_screen_name=test_list_owner_screen_name)
@unittest.skip('skipping non-updated test')
def test_get_specific_list(self):
"""Test getting specific list succeeds"""
self.api.get_specific_list(slug=test_list_slug,
owner_screen_name=test_list_owner_screen_name)
@unittest.skip('skipping non-updated test')
def test_get_list_subscriptions(self):
"""Test collection of the lists the specified user is
subscribed to succeeds"""
self.api.get_list_subscriptions(screen_name='twitter')
@unittest.skip('skipping non-updated test')
def test_show_owned_lists(self):
"""Test collection of lists the specified user owns succeeds"""
self.api.show_owned_lists(screen_name='twitter')
# Saved Searches
@unittest.skip('skipping non-updated test')
def test_get_saved_searches(self):
"""Test getting list of saved searches for authenticated
user succeeds"""
self.api.get_saved_searches()
@unittest.skip('skipping non-updated test')
def test_create_get_destroy_saved_search(self):
"""Test getting list of saved searches for authenticated
user succeeds"""
saved_search = self.api.create_saved_search(query='#Twitter')
saved_search_id = saved_search['id_str']
self.api.show_saved_search(id=saved_search_id)
self.api.destroy_saved_search(id=saved_search_id)
# Places & Geo
@unittest.skip('skipping non-updated test')
def test_get_geo_info(self):
"""Test getting info about a geo location succeeds"""
self.api.get_geo_info(place_id='df51dec6f4ee2b2c')