Ejemplo n.º 1
0
 def getRecipeDetails(self, idsString):
     """
     Get details about recipes
     :param idsString: list of ids to get
     :return:
     """
     url = apiBaseUrl + apiEndpoints["Recipes"]
     ids = idList2String(idsString)
     params = {
         "lang": apiLanguage,
         "ids": ids
     }
     response = self.httpSession.get(url=url, params=params)
     return response.json()
Ejemplo n.º 2
0
 def getPvPMatchDetails(self):
     """
     Get information about last 10 played pvp-matches.
     :return: list of dict with match-information
     """
     idsString = idList2String(self.getPvPMatchIds())
     url = apiBaseUrl + apiEndpoints["PvpMatches"]
     params = {
         "lang": apiLanguage,
         "access_token": self.api_key,
         "ids": idsString
     }
     response = self.httpSession.get(url=url, params=params)
     return response.json()
Ejemplo n.º 3
0
 def getCurrencies(self):
     """
     Get all currencies known to the game.
     :return: a list of dict with information about currencies
     """
     url = apiBaseUrl + apiEndpoints["Currencies"]
     params = {
         "lang": apiLanguage
     }
     response = self.httpSession.get(url=url, params=params)
     # feed response-list in helper to format it into a string ids=1,2,3
     idsString = idList2String(response.json())
     params = {
         "lang": apiLanguage,
         "ids": idsString
     }
     response = self.httpSession.get(url=url, params=params)
     return response.json()
Ejemplo n.º 4
0
 def getMaps(self):
     """
     Get information about maps from the api.
     :return: information about all maps as list of dict
     """
     url = apiBaseUrl + apiEndpoints["Maps"]
     params = {"lang": apiLanguage}
     response = self.httpSession.get(url=url, params=params)
     mapIds = response.json()
     mapData = []
     if len(mapIds) > 0:
         mapdIsChunked = idList2Chunks(mapIds)
         for chunk in mapdIsChunked:
             idsString = idList2String(chunk)
             params = {"lang": apiLanguage,
                       "ids": idsString}
             response = self.httpSession.get(url=url, params=params)
             mapData.extend(response.json())
     return mapData
Ejemplo n.º 5
0
    def getItem(self, itemId=None, idsString=None):
        """
        Get Details about an item or multiple items
        :param itemId: Set if only item
        :param idsString: Set to get multiple Items at once
        :return: (list of) dict of details about items
        """
        url = apiBaseUrl + apiEndpoints["Items"]

        if idsString:
            ids = idList2String(idsString)
        elif itemId:
            ids = itemId

        params = {
            "lang": apiLanguage,
            "ids": ids
        }
        response = self.httpSession.get(url=url, params=params)
        return response.json()
Ejemplo n.º 6
0
    def getPrice(self, itemId=None, idsString=None):
        """
        Get price-information either about a single item or a list of items.
        :param itemId: set to get information about one item
        :param idsString: set to get information about multiple items at once
        :return: (list of) dict with information
        """
        url = apiBaseUrl + apiEndpoints["ItemPrices"]

        if idsString:
            ids = idList2String(idsString)
        elif itemId:
            ids = itemId

        params = {
            "lang": apiLanguage,
            "ids": ids
        }
        response = self.httpSession.get(url=url, params=params)
        return response.json()