旧式的Runescape图书馆
OSRS-Hiscores的Python项目详细描述
OSRS Hiscores API库
目的
这个库的目的是与老式runescape(osrs)的hiscores页面交互,并允许开发人员以更直观的方式(通过字典)访问stat级别、等级和体验级别。此库通过http.client
请求访问此信息,并相应地解析该信息。
安装
python -m pip install OSRS-Hiscores
示例用法
fromOSRS_HiscoresimportHiscores# User to lookupusername='Zezima'# Initialize user object, if no account type is specified, we assume 'N'user=Hiscores(username,'N')# Get the entire stat dictionaryuser.stats# Get total Levelsuser.skill('total')# Get a specific skill's ranking, level, and experienceuser.stats['runecrafting']# Get skill's level, ranking, and experience separatelyuser.stats['runecrafting']['level']user.stats['runecrafting']['rank']user.stats['runecrafting']['experience']# NEWuser.stats['runecrafting']['next_level_experience']# Total Exp needed for next leveluser.stats['runecrafting']['exp_to_next_level']# Exp remaining til next level# A simpler way to just get a skill's attributesprint("Current level:",user.skill('attack','level'))print("Current rank:",user.skill('attack','rank'))print("Current exp:",user.skill('attack','experience'))print("Exp remaining:",user.skill('attack','exp_to_next_level'))