예제 #1
0
 def makeRequest(self, url):
     return utils.makeASCIIFromJSON(
         requests.get(url,
                      headers={
                          self.headerKey: self.headerValue,
                          self.authHeaderKey: self.authCode
                      }).json())
예제 #2
0
 def makeAdvancedRequest(self, url, headers, shouldReturnHeaders):
     headersDict = {
         self.headerKey: self.headerValue,
         self.authHeaderKey: self.authCode
     }
     headersDict.update(headers)
     r = requests.get(url, headers=headersDict)
     if r.status_code == 200:
         responseData = utils.makeASCIIFromJSON(r.json())
     else:
         return [r.status_code, None, None]
     return [
         r.status_code, r.headers, responseData
     ] if shouldReturnHeaders else [r.status_code, None, responseData]
예제 #3
0
 def makeSingleMatchRequest(self, matchNum):
     url = self.basicURL + 'match/' + str(self.key) + '_qm' + str(matchNum)
     return utils.makeASCIIFromJSON(self.makeRequest(url))
예제 #4
0
    print dicts
    return {
        d: map(
            np.mean,
            zip(*map(lambda tm: tm.get(d)
                     if tm.get(d) != None else [0], dicts)))
        for d in extendList(map(lambda x: x.keys(), dicts))
    }


while True:
    tempTIMDs = firebase.child("TempTeamInMatchDatas").get().val()
    if tempTIMDs == None:
        print "No data"
        time.sleep(1)
        continue
    consolidationGroups = {}
    for (temptimdKey, temptimd) in tempTIMDs.items():
        actualKey = temptimdKey.split("-")[0]
        if actualKey in consolidationGroups.keys():
            consolidationGroups[actualKey].append(temptimd)
        else:
            consolidationGroups[actualKey] = [temptimd]

    consolidationGroups = utils.makeASCIIFromJSON(consolidationGroups)
    map(
        lambda key: firebase.child("TeamInMatchDatas").child(key).update(
            joinValues(key)), consolidationGroups.keys())
    print str(map(joinValues, consolidationGroups.keys())) + " consolidated"
    time.sleep(1)
예제 #5
0
def getPythonObjectForFirebaseDataAtLocation(location):
    return utils.makeASCIIFromJSON((firebase.get(location, None)))
예제 #6
0
def getPythonObjectForFirebaseDataAtLocation(location):
	return utils.makeASCIIFromJSON((firebase.get(location, None)))
예제 #7
0
 def getPythonObjectForFirebaseDataAtLocation(self, location):
     return utils.makeASCIIFromJSON(
         self.firebase.child(location).get().val())
예제 #8
0
	def makeSingleMatchRequest(self, matchNum):
		url = self.basicURL + "match/" + str(self.key) + "_qm" + str(matchNum)
		return utils.makeASCIIFromJSON(self.makeRequest(url))
예제 #9
0
	def makeRequest(self, url):
		return utils.makeASCIIFromJSON(requests.get(url, headers={self.headerKey: self.headerValue}).json())