ramonsaraiva / pubg-python

A python wrapper for the PUBG developer API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Key Error

wookienz opened this issue · comments

Code:
from pubg_python import PUBG, Shard
import config

api = PUBG(config.api_key, Shard.PC_AS)
sample = api.samples().get()
match = api.matches().get('8648bf56-82a2-4377-a2a7-de65c03ec8df')
asset = match.assets[0]
telemetry = api.telemetry(asset.url)
print(len(telemetry.events))

Error:

telemetry = api.telemetry(asset.url)
File "/home/wookienz/Projects/Coding/nemesis/lib64/python3.6/site-packages/pubg_python-0.3.2-py3.6.egg/pubg_python/base.py", line 52, in telemetry
File "/home/wookienz/Projects/Coding/nemesis/lib64/python3.6/site-packages/pubg_python-0.3.2-py3.6.egg/pubg_python/domain/telemetry/base.py", line 13, in init
File "/home/wookienz/Projects/Coding/nemesis/lib64/python3.6/site-packages/pubg_python-0.3.2-py3.6.egg/pubg_python/domain/telemetry/base.py", line 13, in
File "/home/wookienz/Projects/Coding/nemesis/lib64/python3.6/site-packages/pubg_python-0.3.2-py3.6.egg/pubg_python/domain/telemetry/events.py", line 18, in instance
File "/home/wookienz/Projects/Coding/nemesis/lib64/python3.6/site-packages/pubg_python-0.3.2-py3.6.egg/pubg_python/domain/telemetry/events.py", line 8, in init
File "/home/wookienz/Projects/Coding/nemesis/lib64/python3.6/site-packages/pubg_python-0.3.2-py3.6.egg/pubg_python/domain/telemetry/events.py", line 179, in from_dict
File "/home/wookienz/Projects/Coding/nemesis/lib64/python3.6/site-packages/pubg_python-0.3.2-py3.6.egg/pubg_python/domain/telemetry/events.py", line 13, in from_dict
File "/home/wookienz/Projects/Coding/nemesis/lib64/python3.6/site-packages/pubg_python-0.3.2-py3.6.egg/pubg_python/domain/telemetry/data.py", line 11, in getitem
KeyError: '_V'

The request appears to fire correctly. However it errors while trying to store data in the following function:

class TelemetryData(collections.MutableMapping):

def __getitem__(self, key):
    value = self.store[self.__keytransform__(key)]
    if isinstance(value, dict):
        return self.__class__(value)
    return value

Specifically just after trying to insert: '2018-06-30T23:27:10.5366766Z'

FYI.

old api, now not using

self.version = self._data['_V']

https://documentation.playbattlegrounds.com/en/changelog/changelog.html

Removed:

(any).common.mapName //available in LogMatchStart
(any).common.matchId //available in LogMatchDefinition
(any)._V
LogPlayerLogin.errorMessage
LogPlayerLogin.result

Faced the same problem. Did anyone fixed it?

The master repo should be good now. My pull request was accepted. However...... It is still broken as per other pull requests.

My 1.5 fork works.

Sorry guys, will publish the updated branch tomorrow early morning, will also review/approve the opened pull requests.

Version 0.3.3 uploaded to PyPI.