Skip to main content
observer logo

ObserverAPI

Discord Discord
Stars Version

Observer API Wrapper in Python

Introduction

This is the first Observer API Wrapper in Python.
This API Wrapper currently supports all endpoints (GET and POST).
You can find them all in the Documentation.

If you need help please join Polsu Development Support Server.

Installing

Install the ObserverAPI using pip
> Current Version: 1.1.5

py -m pip install ObserverAPI

This library was only tested with python 3.10 but I set it to 3.8 since I think everything should work. Please report me any issues! Thank you.

Usage

A Basic Example:

from ObserverAPI import Observer
import asyncio

async def main():
    client = await Observer(key="XXX") #define the client with your Observer API Key

    # Get the stats of Technoblade (UUID: b876ec32e396476ba1158438d83c67d4) 100 days ago
    lookback = await client.lookback.get("b876ec32e396476ba1158438d83c67d4", 100)
    print(lookback.bedwars.level)
    
    # Observer API Stats
    api_stats = await client.stats.get()
    print(api_stats.trackedPlayers)
    
    # Get the Top 10 players, All-Time Bedwars Wins Leaderboard 
    leaderboard = await client.leaderboard.get("alltime", "bedwars", "wins", 1, 10)
    print(leaderboard.leaderboard)
    
    # Get the second player on the leaderboard
    second_player_on_leaderboard = leaderboard.get_index(2)
    print(second_player_on_leaderboard.formatted, second_player_on_leaderboard.rank, second_player_on_leaderboard.value)

    # Get Technoblade (UUID: b876ec32e396476ba1158438d83c67d4) leaderboard rank, in this case in the All-Time Bedwars Wins Leaderboard
    ranking = await client.ranking.get("b876ec32e396476ba1158438d83c67d4", "alltime", "bedwars", "wins")
    print(ranking.rank)
    
    # Get the formatted name of a Player, in this case, Technoblade (UUID: b876ec32e396476ba1158438d83c67d4) -> §d[PIG§b+++§d] Technoblade
    formatted = await client.formatted.get("b876ec32e396476ba1158438d83c67d4")
    print(formatted.formatted)

asyncio.get_event_loop().run_until_complete(main()) # launch the main function

You can find this example and more examples in the examples folder

Links

License

This project is under the MIT License.

Release files for ObserverAPI 1.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ObserverAPI 1.1.5
File Size Uploaded
ObserverAPI-1.1.5.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ObserverAPI 1.1.5
File Interpreter ABI Platform
ObserverAPI-1.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / ObserverAPI-1.1.5.tar.gz

Download URL ObserverAPI-1.1.5.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
489dc2382b6725167caa7abe61586fa0f9c32d265f1b502faedf20aec2e0c33b
BLAKE2b-256 checksum
How to use checksums
f06d4edd50a4dcf86ebf5cdc20aeac5fb97aca157b80c11d20c1eaf184caf4f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

Release files / ObserverAPI-1.1.5-py3-none-any.whl

Download URL ObserverAPI-1.1.5-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da277d7341a1b245dc146aa14cefc059e615570c4e5031a0e6ae69ec72d3171c
BLAKE2b-256 checksum
How to use checksums
1e92ac67511eef1276f8f61e849ab3bcb75eb0330ec7711c813e3dab306e1a3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

Release history Release notifications | RSS feed

This release

1.1.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page