本文整理匯總了Python中scrobbler.Scrobbler.build_headers方法的典型用法代碼示例。如果您正苦於以下問題:Python Scrobbler.build_headers方法的具體用法?Python Scrobbler.build_headers怎麽用?Python Scrobbler.build_headers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scrobbler.Scrobbler
的用法示例。
在下文中一共展示了Scrobbler.build_headers方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: rc
# 需要導入模塊: from scrobbler import Scrobbler [as 別名]
# 或者: from scrobbler.Scrobbler import build_headers [as 別名]
if __name__ == "__main__":
limits = {
'NA': (3000, 'orange', 'North America'),
'EU': (10000, 'blue', 'Europe'),
'RU': (30000, 'red', 'Russia'),
'ASIA': (1000, 'green', 'Asia'),
'KR': (500, 'purple', 'Korea'),
}
rc('font', **{'family':'serif'})
for server in ['EU', 'NA', 'RU', 'ASIA', 'KR']:
print server
# scrob = Scrobbler(min_points=5000, max_pages=90, max_rank=90000, max_players=90000)
scrob = Scrobbler(min_points=5000, max_pages=90, max_rank=90000, max_players=90000)
scrob.page_size = 1000
scrob.build_headers(server)
try:
data = scrob.scrobble()
x = []
y = []
for player in scrob.ranking:
x.append(scrob.players[player[0]]['real_position'])
y.append(player[1])
if scrob.players[player[0]]['real_position'] == limits[server][0]:
cutoffx = [limits[server][0], limits[server][0]]
cutoffy = [0, player[1]]
plot(cutoffx, cutoffy, color=limits[server][1], label="_"+str(player[1]))
示例2: Scrobbler
# 需要導入模塊: from scrobbler import Scrobbler [as 別名]
# 或者: from scrobbler.Scrobbler import build_headers [as 別名]
__author__ = 'nic'
from scrobbler import Scrobbler
import texttable
if __name__ == "__main__":
scrob = Scrobbler(max_rank=12000)
scrob.build_headers('NA')
data = scrob.scrobble()
print 'indexed players: ', str(scrob.current_count) + "/" + str(scrob.total_count) + " (" + str(
round((float(scrob.current_count) / float(scrob.total_count)) * 100)) + "\%)", 'pages scrobbled: ', scrob.current_page
print ''
print '-----------------------------------------'
print 'Clan Search: QuickyBaby\'s Special forces'
print '-----------------------------------------'
players = texttable.Texttable(max_width=0)
players.set_deco(texttable.Texttable.HEADER)
players.set_cols_dtype(['i', 'i', 't', 't', 'i', 'i', 'i'])
players.add_row(['Current Rank', 'Real Rank', 'Name', 'Clan', 'Points', 'Delta', 'Real Delta'])
for x in scrob.find_clan(['otter']):
players.add_row(
[x['position'], x['real_position'], x['name'], scrob.clans[x['clan']]['tag'].upper(), x['points'],
x['delta'], x['real_delta']])
print players.draw()
print ''
print '------------------------------------------'
print 'top clans by number of players in top 10 k'