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, PlayerType.DEADMAN_MODE, PlayerType.SEASONAL and PlayerType.TOURNAMENT
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-3.0.0.tar.gz (8.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: osrs_hiscores_client-3.0.0.tar.gz
  • Upload date:
  • Size: 8.0 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-3.0.0.tar.gz
Algorithm Hash digest
SHA256 0582cfdc5f9f1ef04f2c143f39d03fb92a4397f4ec771fdd112b5c55b8babdeb
MD5 10db52efacfd83312113918e11f06852
BLAKE2b-256 8766418b750b52e3bf816ccc76fd36e4db48ae9568d510a2f73b87a87f05198d

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