semvec/pypi-packages huggingface dataset:
pubg-toolbox 0.0.5
Simple queries and handles for PUBG data analysis
Requires Python: >=3

# pubg-toolbox
A set of API wrappers to query PUBG game data according to [official APIs](https://documentation.pubg.com/en/introduction.html#json-api), read it to learn more details.

Essentially the APIs needed, at least for my project, provide simple ways to get get pubg data in json format given the `player name`, `platform` and `season`. As for what to process with the obtained data, they are up to use cases. Therefore this toolbox focus on getting the data easily.

## Goal 0.1:
* Complete APIs listed to get json data in an easy and stable manner
* Exception handling for query failure
* API names clean up
* Tests complete

## Goal 0.2:
* Add APIs to retrieve frequently used data from json returned

## How to Use

### Client
Creating a client is easy
```
from pubg_toolbox.client import PUBGClient
client = PUBGClient('<API key>')
```

### Player
```
from pubg_toolbox.data_types.queries import PlayerQuery
from pubg_toolbox.data_types.types import Player

data = client.request(PlayerQuery('<id>', '<platform>'))
player = Player(data)
```
Get recent played match ids
```
player.matches
```

### Seasons
```
from pubg_toolbox.data_types.queries import SeasonsQuery
from pubg_toolbox.data_types.types import Seasons

data = client.request(SeasonsQuery('<platform>'))
seasons = Seasons(data)
```

Get a list of season ids by
```
seasons.get_all_seasons()
```

Get current season id by
```
seasons.get_current_season()
```

### Matches
```
from pubg_toolbox.data_types.queries import MatchesQuery
from pubg_toolbox.data_types.types import Matches

data = client.request(MatchesQuery('<account id>', '<season is>'))
matches = Matches(data)
```

Get match ids per game modeby
```
matches.get_matches('matchesSolo')

```

### Match
```
from pubg_toolbox.data_types.queries import MatchQuery
from pubg_toolbox.data_types.types import Match

data = client.request(MatchQuery('<match id>'))
match = Match(data)
```
The most important feature is to get the telemetry url so we can look further into it:
```
match.get_telemetry_url()
```

You can also get useful information such as
```
match.created_at # match date
match.get_match_map() # match map
match.get_game_mode() # match game mode
```

### Telemetry
Telemetry is a bit more complicated as you need get a match first.
With the Match object created from above, use `get_telemetry_url` to get the telemtry CDN url.
```
from pubg_toolbox.data_types.queries import TelemetryQuery

data = client.request(TelemetryQuery('<telemetry url>'))
```