From bd729343665b8a4b86bc98b5dfcd9fe529bf87b2 Mon Sep 17 00:00:00 2001 From: "jamison.andaluz@gmail.com" Date: Mon, 25 Mar 2019 23:18:24 -0400 Subject: [PATCH 1/5] return zone data for character obj --- pubg_python/domain/telemetry/objects.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pubg_python/domain/telemetry/objects.py b/pubg_python/domain/telemetry/objects.py index de6369f..3df7d23 100644 --- a/pubg_python/domain/telemetry/objects.py +++ b/pubg_python/domain/telemetry/objects.py @@ -87,6 +87,7 @@ def from_dict(self): self.location = Location(self._data.get('location', {})) self.ranking = self._data.get('ranking') self.account_id = self._data.get('accountId') + self.zone = self._data.get('zone') class Vehicle(Object): From 2674e43452ba641b489fcf15ddfd31e614efd7c6 Mon Sep 17 00:00:00 2001 From: "jamison.andaluz@gmail.com" Date: Thu, 28 Mar 2019 22:57:15 -0400 Subject: [PATCH 2/5] allow for query strings at the end of get requests --- pubg_python/clients.py | 5 +++-- pubg_python/querysets.py | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pubg_python/clients.py b/pubg_python/clients.py index a0664d0..d83aff1 100644 --- a/pubg_python/clients.py +++ b/pubg_python/clients.py @@ -23,9 +23,10 @@ def __init__(self): self.session.headers.update({'Accept': 'application/vnd.api+json'}) self.url = furl.furl() - def request(self, endpoint): + def request(self, endpoint, **kwargs): + self.session.params = kwargs.get('params',None) response = self.session.get(endpoint, timeout=DEFAULT_TIMEOUT) - + response.encoding = "utf-8" if response.status_code != self.API_OK: exception = self.API_ERRORS_MAPPING.get( response.status_code, exceptions.APIError) diff --git a/pubg_python/querysets.py b/pubg_python/querysets.py index 34c7d52..006d22c 100644 --- a/pubg_python/querysets.py +++ b/pubg_python/querysets.py @@ -31,15 +31,15 @@ def __getitem__(self, key): return Domain.instance({'data': self._data['data'][key]}) @invalidates_cache - def get(self, id=None): + def get(self, id=None, **kwargs): # get can be a fetchy filter in the future if id: self.endpoint.path.segments.append(id) - self.fetch() + self.fetch(**kwargs) del self.endpoint.path.segments[-1] # dirty? return Domain.instance(self._data) - def fetch(self): + def fetch(self, **kwargs): if self._data: return - self._data = self.client.request(self.endpoint) + self._data = self.client.request(self.endpoint, **kwargs) From 4f99c62a90b71148316eac501ade6625e523bc3c Mon Sep 17 00:00:00 2001 From: "jamison.andaluz@gmail.com" Date: Thu, 28 Mar 2019 23:01:56 -0400 Subject: [PATCH 3/5] don't need to force encoding --- pubg_python/clients.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubg_python/clients.py b/pubg_python/clients.py index d83aff1..8bb0af4 100644 --- a/pubg_python/clients.py +++ b/pubg_python/clients.py @@ -26,7 +26,7 @@ def __init__(self): def request(self, endpoint, **kwargs): self.session.params = kwargs.get('params',None) response = self.session.get(endpoint, timeout=DEFAULT_TIMEOUT) - response.encoding = "utf-8" + if response.status_code != self.API_OK: exception = self.API_ERRORS_MAPPING.get( response.status_code, exceptions.APIError) From 4da13bb441aba32f94a62044958a67437e0ec543 Mon Sep 17 00:00:00 2001 From: "jamison.andaluz@gmail.com" Date: Sat, 13 Apr 2019 02:44:42 -0400 Subject: [PATCH 4/5] add damange caused by to kill event --- pubg_python/domain/telemetry/events.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pubg_python/domain/telemetry/events.py b/pubg_python/domain/telemetry/events.py index 791f064..c20da1c 100644 --- a/pubg_python/domain/telemetry/events.py +++ b/pubg_python/domain/telemetry/events.py @@ -14,7 +14,10 @@ def from_dict(self): @staticmethod def instance(data): - return globals()[data['_T']](data) + try: + return globals()[data['_T']](data) + except: + pass class LogPlayerLogin(Event): @@ -88,6 +91,7 @@ def from_dict(self): self.damage_type_category = self._data.get('damageTypeCategory') self.damage_reason = self._data.get('damageReason') self.distance = self._data.get('distance') + self.damage_causer_name = self._data.get('damageCauserName') class LogParachuteLanding(Event): @@ -143,7 +147,7 @@ class LogItemDetach(LogItemBundle): pass -class LogItemPickupFromCarePackage(LogItemPickup): +class LogItemPickupFromCarepackage(LogItemPickup): pass From 3af0c8148f16d0e2729f39b4c0a622f3ab231890 Mon Sep 17 00:00:00 2001 From: "jamison.andaluz@gmail.com" Date: Wed, 17 Apr 2019 20:54:00 -0400 Subject: [PATCH 5/5] reinstate raise on exception for globals --- pubg_python/domain/telemetry/events.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pubg_python/domain/telemetry/events.py b/pubg_python/domain/telemetry/events.py index c20da1c..72a9772 100644 --- a/pubg_python/domain/telemetry/events.py +++ b/pubg_python/domain/telemetry/events.py @@ -14,10 +14,7 @@ def from_dict(self): @staticmethod def instance(data): - try: - return globals()[data['_T']](data) - except: - pass + return globals()[data['_T']](data) class LogPlayerLogin(Event):