Skip to main content

PUBG API wrapper module

Project description

PUBG API Wrapper for Pandas

This package is under development; thus, some features may not work correctly or exist.

Installation

You can install this module using pip (pip3)

pip install pubgapi-ku

Modules

1. API Connector

The module contains Connector class which has functions to get raw JSON data using PUBG API provided by PUBG Developer Portal (https://developer.pubg.com/). All data which can be collected using this module can also be collected by the DataWrapper class, which provides data as Pandas DataFrame type using Connector class internally. Therefore, there is no need to necessarily use API Connector module and Connector class in most cases.

Usage

To use Connector class, you must generate a PUBG API key. Refer instruction of PUBG Developer Portal (https://documentation.pubg.com/en/getting-started.html)

from pubgapiku.api_connector import Connector

conn = Connector(<your_api_key>, 'steam')
sample_matches:dict = conn.sample_matches()

Functions

__init__ (self, api_key:str, platform:PLATFORM, timeout:int=1)

Initialize API request sender

Arguments

api_key:str An API key of the PUBG Developer Portal platform:PLATFORM Target platform to collect data (steam, kakao, console, psn, stadia, tournament, xbox) timeout:int Timeout limitation (sec), default=1  

sample_matches (self, date_filter:str='') -> dict

Return dictionary-type data containing a list of sample matches within 24 hours in UTC starting from the targeted date When the API request is unsuccessful (the response code was not 200), an assertion error will be occurred

Arguments

date_filter:str Target date to collect sample match list (optional). Formatted as YYYYMMDD.  

players (self, **kargs) -> dict

Return a dictionary-type value containing players information When the API request was not successful (the response code was not 200), the function returns None

Keyword Arguments

ids:list[str] Filters by player ID names:list[str] Filters by player names  

match (self, match_id:str) -> dict

Return a dictionary-type value containing a match's information When the API request was not successful (the response code was not 200), the function returns None

Arguments

match_id:str The ID of the match for which you want to collect information  

telemetry_addr (self, match_data:dict) -> str

Return the address of telemetry data of a match from the match's data When the address of telemetry data was not found, the function return None

Arguments

match_data:dict A match data which is obtained from match function  

get_telemetry (self, addr:str) -> list

Return a dictionary-type value containing a match's telemetry data of the target match When the request was not successful (the response code was not 200), the function returns None

Arguments

addr:str The address of the target telemetry data obtained from telemetry_addr function  


2. Data Wrapper

The module contains DataWrapper class, which has functions to get PUBG data from PUBG API as Pandas DataFrame data type Since DataWrapper class works based on Collector class, a PUBG API key is also needed to use DataWrapper class

Usage

import pandas as pd
from pubgapiku.data_wrapper import DataWrapper

wrapper = DataWrapper(<your_api_key>, 'steam')
sample_matches:list = wrapper.get_sample_matches()
players:pd.DataFrame = wrapper.get_players_in_match(sample_matches[0])

Functions

__init__ (self, api_key:str, platform:PLATFORM, timeout:int=1)

Initialize a data wrapper instance, which contains a Connector instance

Arguments

api_key:str An API key of the PUBG Developer Portal platform:PLATFORM Target platform to collect data (steam, kakao, console, psn, stadia, tournament, xbox) timeout:int Timeout limitation (sec), default=1  

get_sample_matches (self, date_filter:str='') -> list

Return a list of sample matches within 24 hours in UTC starting from the targeted date

Arguments

date_filter:str Target date to collect sample match list (optional). Formatted as YYYYMMDD.  

get_players_in_match (self, match_id:str) -> pd.DataFrame

Get a dataframe containing player names and account ids of a match

Arguments

match_id:str The target match's id  

get_player_data (self, **kargs) -> pd.DataFrame

Get a dataframe containing matches and corresponding players to each match

Keyword Arguments

ids:list[str] filters by player IDs names:list[str] filters by player names  

get_match_data (self, match_id:str) -> tuple[dict, pd.DataFrame, pd.DataFrame]

Get a tuple of dataframe containing a match's metadata, participants list, and telemetry data

Arguments

match_id:str target match's id  

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

pubgapi_ku-0.16.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pubgapi_ku-0.16-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file pubgapi_ku-0.16.tar.gz.

File metadata

  • Download URL: pubgapi_ku-0.16.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for pubgapi_ku-0.16.tar.gz
Algorithm Hash digest
SHA256 0d7b916a783a733ccd734cfcd9ae85618eee6210684c39199b96441f7abbb931
MD5 66abdbecfc3dbbae2dfeb40ac4af2469
BLAKE2b-256 51a94977718b681f55f4dc8f9b988437d50ee76593491e78be88b079cf3494e5

See more details on using hashes here.

File details

Details for the file pubgapi_ku-0.16-py3-none-any.whl.

File metadata

  • Download URL: pubgapi_ku-0.16-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for pubgapi_ku-0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 d2be3a707ab6d0e6bb655f597ce85f3c54c39aa0a09c218fcd5f65be4f4420d5
MD5 7cf74c6d1f4b5970772583a1fd4963f2
BLAKE2b-256 6f356f476cbb1d2b31c2623476d1d9da3aec7e0dc274f8d16777f82a15a83b69

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