summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-01-17 22:42:49 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-01-17 22:42:49 +0100
commit26fd9c1005952b26c447d122bff27306b2a283eb (patch)
treed59e8fbfe8e30bc681489ebc379d50e527bc8d2a
parent551f04304a48c2ad78da8e8dd36bd7717a138d33 (diff)
downloadpython-gamelocker-26fd9c1005952b26c447d122bff27306b2a283eb.tar.gz
python-gamelocker-26fd9c1005952b26c447d122bff27306b2a283eb.zip
region shard support
-rw-r--r--gamelocker/api.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/gamelocker/api.py b/gamelocker/api.py
index 50c13a4..112ec8c 100644
--- a/gamelocker/api.py
+++ b/gamelocker/api.py
@@ -41,6 +41,7 @@ class Gamelocker(object):
self.apikey = apikey
self._apiurl = "https://api." + datacenter + ".gamelockerapp.com/"
self.title = ""
+ self.region = ""
def _req(self, method, params=None):
"""Sends a GET request to the API endpoint.
@@ -75,7 +76,8 @@ class Gamelocker(object):
:return: Data object.
:rtype: :class:`janus.DataMessage`
"""
- data = self._req(endpoint + "/" + elid, params=params)
+ data = self._req("shards/" + self.region + "/" +
+ endpoint + "/" + elid, params=params)
# collect related data
includes = []
@@ -100,13 +102,16 @@ class Gamelocker(object):
element = gamelocker.datatypes.link_to_object(element, includes)
return element
- def Vainglory(self):
- """Sets title to Vainglory.
+ def Vainglory(self, region="na"):
+ """Sets title to Vainglory and data region.
+ :param region: (optional) Data region (shard) to use. Defaults to NA.
+ :type region: str
:return: :class:`Gamelocker <Gamelocker>` object
:rtype: gamelocker.Gamelocker
"""
self.title = "semc-vainglory"
+ self.region = region
return self
def status(self):