Skip to main content

Python client for Old School RuneScape Hiscores API.

Project description

OSRS Hiscores

Simple OSRS Hiscores client for Python.


Installation

pip install osrs-hiscores-client

Usage

from osrs_hiscores.client import HiscoresClient
from osrs_hiscores.enums import PlayerType, Skill, Activity

rsn = "Lynx Titan"

client = HiscoresClient()

# PlayerType also has PlayerType.IRONMAN, PlayerType.HARDCORE_IRONMAN and PlayerType.ULTIMATE_IRONMAN
stats = client.get_player_stats(rsn, PlayerType.NORMAL)

# You can access specific skill using ID.
agility_skill = stats.get_skill_by_id(Skill.AGILITY)

if agility_skill is not None:
    print(f"Player {stats.rsn} has agility level of {agility_skill.level}, {agility_skill.experience} experience and rank {agility_skill.rank}.")
    # Player Lynx Titan has agility level of 99, 200000000 experience and rank 24.

# You can loop all skills.
for skill in stats.skills.values():
    print(f"Player {stats.rsn} has {skill.name} level of {skill.level}, {skill.experience} experience and rank {skill.rank}.")

# You can access specific activity using ID.
jad_activity = stats.get_activity_by_id(Activity.TZTOK_JAD)

if jad_activity is not None:
    print(f"Player {stats.rsn} has {jad_activity.score} Jad KC and rank {jad_activity.rank}.")
    # Player Lynx Titan has activity TzTok-Jad score of 186 and rank 375.

# You can also loop all activities.
for activity in stats.activities.values():
    print(f"Player {stats.rsn} has activity {activity.name} score of {activity.score} and rank {activity.rank}.")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osrs_hiscores_client-2.0.0.tar.gz (7.8 kB view details)

Uploaded Source

File details

Details for the file osrs_hiscores_client-2.0.0.tar.gz.

File metadata

  • Download URL: osrs_hiscores_client-2.0.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for osrs_hiscores_client-2.0.0.tar.gz
Algorithm Hash digest
SHA256 dc80d277196b35b5040d415a520a6372a11ee650c191f1bf4a7c05fb6f74f8a5
MD5 9a25a8a085aa35dc2f5cf8990f1831a2
BLAKE2b-256 493886b780ad214d127cf1f897af77a44834e948f1fdbb1637108966a4dfe566

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page