def getFileAccessInfo(useProductionEnvironment: bool, filename: str) -> GraphFileAccessInfo: graphRootUrl = "" if useProductionEnvironment: graphRootUrl = "https://graph.microsoft.com/testexcel" else: graphRootUrl = "https://graph.microsoft-ppe.com/testexcel" accessToken = OAuthUtility.getAccessToken(useProductionEnvironment) requestInfo = httphelper.RequestInfo() requestInfo.method = "GET" requestInfo.url = graphRootUrl + "/me/drive/root/children" requestInfo.headers["Authorization"] = "Bearer " + accessToken responseInfo = httphelper.HttpUtility.invoke(requestInfo) if responseInfo.statusCode != 200: raise RuntimeError("Cannot get files") resp = json.loads(responseInfo.body) files = resp.get("value") fileId = "" for file in files: if file.get("name") is not None and file.get( "name").upper() == filename.upper(): fileId = file.get("id") break if len(fileId) == 0: raise RuntimeError("Cannot find file") ret = GraphFileAccessInfo() ret.fileId = fileId ret.accessToken = accessToken ret.fileWorkbookUrl = graphRootUrl + "/me/drive/items/" + fileId + "/workbook" return ret
def sync(self): req = self.__pendingRequest if req is None: return if not req.hasActions: return self.__pendingRequest = None msgBody = req.buildRequestMessageBody() requestInfo = httphelper.RequestInfo(); requestInfo.url = Utility.combineUrl(self._url, "ProcessQuery") requestInfo.body = json.dumps(msgBody, default = lambda o: o.__dict__) requestInfo.method = "POST" for key, value in self._requestHeaders.items(): requestInfo.headers[key] = value requestInfo.headers["CONTENT-TYPE"] = "application/json" requestExecutor = self.customRequestExecutor if (requestExecutor is None): requestExecutor = self._requestExecutor responseInfo = requestExecutor.execute(requestInfo) if responseInfo.statusCode != 200: raise Utility.createRuntimeError("NetworkError") response = json.loads(responseInfo.body) req.processResponse(response) return
def closeSession(requestUrlAndHeaders: runtime.RequestUrlAndHeaderInfo): requestInfo = httphelper.RequestInfo() requestInfo.url = requestUrlAndHeaders.url + "/closeSession" for key, value in requestUrlAndHeaders.headers.items(): requestInfo.headers[key] = value requestInfo.method = "POST" httphelper.HttpUtility.invoke(requestInfo)
def _getAccessTokenFromRefreshToken(clientId : str, tokenSvcUrl : str, refreshToken : str) -> str: requestInfo = httphelper.RequestInfo() requestInfo.url = tokenSvcUrl requestInfo.method = "POST" requestInfo.body = "grant_type=refresh_token&refresh_token=" + refreshToken + "&client_id=" + clientId requestInfo.headers = {} requestInfo.headers["CONTENT-TYPE"] = "application/x-www-form-urlencoded" responseInfo = httphelper.HttpUtility.invoke(requestInfo) if responseInfo.statusCode != 200: raise RuntimeError("Unable to get token") resp = json.loads(responseInfo.body) accessToken = resp.get("access_token") return accessToken
def createBlankExcelFile(parentItemUrl: str, filename: str, requestHeaders: dict): url = parentItemUrl + urllib.parse.quote(":/" + filename + ":/content") blankXlsxFileBase64Content = "UEsDBBQABgAIAAAAIQCkU8XPTgEAAAgEAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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GFJCRCJAQAAEQMAABAAAAAAAAAAAAAAAAAAjBkAAGRvY1Byb3BzL2FwcC54bWxQSwUGAAAAAAkACQA+AgAASxwAAAAA" requestInfo = httphelper.RequestInfo() requestInfo.url = url requestInfo.body = base64.b64decode(blankXlsxFileBase64Content) if (requestHeaders): for key, value in requestHeaders.items(): requestInfo.headers[key] = value requestInfo.headers["CONTENT-TYPE"] = "application/octet-stream" requestInfo.headers["ACCEPT"] = "application/json" requestInfo.method = "PUT" responseInfo = httphelper.HttpUtility.invoke(requestInfo) return parentItemUrl + urllib.parse.quote(":/" + filename + ":/workbook")
def createSessionAndBuildRequestUrlAndHeaders( workbookUrl: str, headers: dict) -> runtime.RequestUrlAndHeaderInfo: url = workbookUrl + "/createSession" requestInfo = httphelper.RequestInfo() requestInfo.url = url if (headers): for key, value in headers.items(): requestInfo.headers[key] = value requestInfo.method = "POST" responseInfo = httphelper.HttpUtility.invoke(requestInfo) session = json.loads(responseInfo.body) sessionId = session.get("id") ret = runtime.RequestUrlAndHeaderInfo() ret.url = workbookUrl for key, value in headers.items(): ret.headers[key] = value ret.headers["Workbook-Session-Id"] = sessionId return ret