Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pubg_python/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ 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)

if response.status_code != self.API_OK:
Expand Down
3 changes: 2 additions & 1 deletion pubg_python/domain/telemetry/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,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):
Expand Down Expand Up @@ -143,7 +144,7 @@ class LogItemDetach(LogItemBundle):
pass


class LogItemPickupFromCarePackage(LogItemPickup):
class LogItemPickupFromCarepackage(LogItemPickup):
pass


Expand Down
1 change: 1 addition & 0 deletions pubg_python/domain/telemetry/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions pubg_python/querysets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)