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

rsn = "Lynx Titan"

client = HiscoresClient()

stats = client.get_player_stats(rsn, PlayerType.NORMAL)

print(f"Player {stats.rsn} has {stats.skills.agility.name} (ID: {stats.skills.agility.id}) level of {stats.skills.agility.level}, {stats.skills.agility.experience} experience and rank {stats.skills.agility.rank}.")
# Player Lynx Titan has Agility (ID: 17) level of 99, 200000000 experience and rank 24.

# You can also loop all skills if you want to!
for skill in stats.skills:
    print(f"Player {stats.rsn} has {skill.name} (ID: {skill.id}) level of {skill.level}, {skill.experience} experience and rank {skill.rank}")

# Player Lynx Titan has Overall (ID: 0) level of 2278, 4600000000 experience and rank 83146
# Player Lynx Titan has Attack (ID: 1) level of 99, 200000000 experience and rank 15
# Player Lynx Titan has Defence (ID: 2) level of 99, 200000000 experience and rank 28
# Player Lynx Titan has Strength (ID: 3) level of 99, 200000000 experience and rank 18
# Player Lynx Titan has Hitpoints (ID: 4) level of 99, 200000000 experience and rank 7
# ...

# Each object can be turn into dictionary if needed.
print(stats.skills.cooking.to_dict())
# {'name': 'Cooking', 'rank': 150, 'level': 99, 'experience': 200000000}

# You can also access the activity statistics.
print(f"Player {stats.rsn} has {stats.activities.barrows_chests.name} (ID: {stats.activities.barrows_chests.id}) kill count of {stats.activities.barrows_chests.score} and rank {stats.activities.barrows_chests.rank}.")
# Player Lynx Titan has Barrows (ID: 25) kill count of -1 and rank -1.

for activity in stats.activities:
    print(f"Player {stats.rsn} has {activity.name} (ID: {activity.id}) score of {activity.score} and rank {activity.rank}")

# Player Lynx Titan has Barrows (ID: 25) score of -1 and rank -1.
# Player Lynx Titan has Grid Points (ID: 0) score of -1 and rank -1
# Player Lynx Titan has League Points (ID: 1) score of -1 and rank -1
# Player Lynx Titan has Deadman Points (ID: 2) score of -1 and rank -1
# ...

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-1.0.1.tar.gz (6.6 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: osrs_hiscores_client-1.0.1.tar.gz
  • Upload date:
  • Size: 6.6 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-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2aa24a7e28241eb76635f28d6d97c49f64f432d6e50c0d7815fdecd8cead16c5
MD5 3c6a734b16116607c033dc57ea82e600
BLAKE2b-256 0de533d9257dd4129859f4251f703af720e36e550ffce15d1c636c7251b326f7

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