本文整理汇总了Python中requests.structures.CaseInsensitiveDict.iteritems方法的典型用法代码示例。如果您正苦于以下问题:Python CaseInsensitiveDict.iteritems方法的具体用法?Python CaseInsensitiveDict.iteritems怎么用?Python CaseInsensitiveDict.iteritems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类requests.structures.CaseInsensitiveDict
的用法示例。
在下文中一共展示了CaseInsensitiveDict.iteritems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tizgmusicproxy
# 需要导入模块: from requests.structures import CaseInsensitiveDict [as 别名]
# 或者: from requests.structures.CaseInsensitiveDict import iteritems [as 别名]
#.........这里部分代码省略.........
""" Return the current track's year of publication.
"""
logging.info("current_song_year")
song = self.now_playing_song
year = 0
if song:
try:
year = song['year']
logging.info("track year %s", year)
except KeyError:
logging.info("year : not found")
else:
logging.info("current_song_year : not found")
return year
def clear_queue(self):
""" Clears the playback queue.
"""
self.queue = list()
self.queue_index = -1
def enqueue_artist(self, arg):
""" Search the user's library for tracks from the given artist and adds
them to the playback queue.
:param arg: an artist
"""
try:
self.__update_local_library()
artist = None
if arg not in self.library.keys():
for name, art in self.library.iteritems():
if arg.lower() in name.lower():
artist = art
print_wrn("[Google Play Music] '{0}' not found. " \
"Playing '{1}' instead." \
.format(arg.encode('utf-8'), \
name.encode('utf-8')))
break
if not artist:
# Play some random artist from the library
random.seed()
artist = random.choice(self.library.keys())
artist = self.library[artist]
print_wrn("[Google Play Music] '{0}' not found. "\
"Feeling lucky?." \
.format(arg.encode('utf-8')))
else:
artist = self.library[arg]
tracks_added = 0
for album in artist:
tracks_added += self.__enqueue_tracks(artist[album])
print_wrn("[Google Play Music] Playing '{0}'." \
.format(to_ascii(artist)))
self.__update_play_queue_order()
except KeyError:
raise KeyError("Artist not found : {0}".format(arg))
def enqueue_album(self, arg):
""" Search the user's library for albums with a given name and adds
them to the playback queue.
"""
try: