Python Azure函数-解码Base64字符串

tp5buhyn  于 2023-03-07  发布在  Python
关注(0)|答案(1)|浏览(156)

我正在开发一个Azure函数,它接受以下格式的请求主体:

"body": {
    "$content-type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    "$content": "UEsDBBQACAgIAEBPY1YAAAAAAAAAAAAAAAAYAAAAeGwvZHJhd2luZ3MvZHJhd2luZzEueG1sndBdbsIwDAfwE+wOVd5pWhgTQxRe0E4wDuAlbhuRj8oOo9x+0Uo2aXsBHm3LP/nvzW50tvhEYhN8I+qyEgV6FbTxXSMO72+zlSg4gtdgg8dGXJDFbvu0GTWtz7ynIu17XqeyEX2Mw1pKVj064DIM6NO0DeQgppI6qQnOSXZWzqvqRfJACJp7xLifJuLqwQOaA+Pz/k3XhLY1CvdBnRz6OCGEFmL6Bfdm4KypB65RPVD8AcZ/gjOKAoc2liq46ynZSEL9PAk4/hr13chSvsrVX8jdFMcBHU/DLLlDesiHsSZevpNlRnfugbdoAx2By8i4OPjj3bEqyTa1KCtssV7ercyzIrdfUEsHCAdiaYMFAQAABwMAAFBLAwQUAAgICABAT2NWAAAAAAAAAAAAAAAAGAAAAHhsL2RyYXdpbmdzL2RyYXdpbmcyLnhtbJ3QXW7CMAwH8BPsDlXeaVoYE0MUXtBOMA7gJW4bkY/KDqPcftFKNml7AR5tyz/5781udLb4RGITfCPqshIFehW08V0jDu9vs5UoOILXYIPHRlyQxW77tBk1rc+8pyLte16nshF9jMNaSlY9OuAyDOjTtA3kIKaSOqkJzkl2Vs6r6kXyQAiae8S4nybi6sEDmgPj8/5N14S2NQr3QZ0c+jghhBZi+gX3ZuCsqQeuUT1Q/AHGf4IzigKHNpYquOsp2UhC/TwJOP4a9d3IUr7K1V/I3RTHAR1Pwyy5Q3rIh7EmXr6TZUZ37oG3aAMdgcvIuDj4492xKsk2tSgrbLFe3q3MsyK3X1BLBwgHYmmDBQEAAAcDAABQSwMEFAAICAgAQE9jVgAAAAAAAAAAAAAAABgAAAB4bC93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AAAAAAAAAAAAAAACxBQAAeGwvd29ya3NoZWV0cy9zaGVldDIueG1sUEsBAhQAFAAICAgAQE9jVoUB9RW0AAAAKgEAACMAAAAAAAAAAAAAAAAAugcAAHhsL3dvcmtzaGVldHMvX3JlbHMvc2hlZXQyLnhtbC5yZWxzUEsBAhQAFAAICAgAQE9jVmWjgWEoAwAArQ4AABMAAAAAAAAAAAAAAAAAvwgAAHhsL3RoZW1lL3RoZW1lMS54bWxQSwECFAAUAAgICABAT2NWhpnahZoAAADJAAAAFAAAAAAAAAAAAAAAAAAoDAAAeGwvc2hhcmVkU3RyaW5ncy54bWxQSwECFAAUAAgICABAT2NWQZwdZw8CAACmBgAADQAAAAAAAAAAAAAAAAAEDQAAeGwvc3R5bGVzLnhtbFBLAQIUABQACAgIAEBPY1adyLt5UQEAAGQDAAAPAAAAAAAAAAAAAAAAAE4PAAB4bC93b3JrYm9vay54bWxQSwECFAAUAAgICABAT2NWP/Ios/IAAABGAwAAGgAAAAAAAAAAAAAAAADcEAAAeGwvX3JlbHMvd29ya2Jvb2sueG1sLnJlbHNQSwECFAAUAAgICABAT2NWpG+hILIAAAAoAQAACwAAAAAAAAAAAAAAAAAWEgAAX3JlbHMvLnJlbHNQSwECFAAUAAgICABAT2NWUVPs0z8BAAAZBQAAEwAAAAAAAAAAAAAAAAABEwAAW0NvbnRlbnRfVHlwZXNdLnhtbFBLBQYAAAAADQANAHcDAACBFAAAAAA="
}

内容是一个Excel文件,我希望在Azure函数内部操作该文件,然后返回一个响应,其主体与请求的格式相同。
我面临的挑战是在解码和编码过程中,从一个基地64,我已经尝试了这个:

import azure.functions as func
import base64

def main(req: func.HttpRequest) -> func.HttpResponse:

    body = req.get_body()

    decrypted=base64.b64decode(body)

    # STUB Load decoded body as a Excel object for cell manipulation

    encrypted = base64.b64encode(decrypted)

    return func.HttpResponse(encrypted, mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')

然而,我的函数的输出是一个损坏的Excel文件,无法加载到应用程序中。
我应该遵循什么正确的过程来解码这个请求主体,然后作为响应返回?
谢谢

hk8txs48

hk8txs481#

我已经在我的环境中进行了复制,并获得了以下预期结果:
首先,我已经采取了样本代码,你可以复制粘贴下面的代码在你的azure函数,我已经给出了如下样本输入:

import base64
en = "SGVsbG8gUml0aHdpaw=="
db = base64.b64decode(en)
de = db.decode("utf-8")
print(de) 
eb = de.encode("utf-8")
en = base64.b64encode(eb).decode("utf-8")
print(en)

我已经采取了上述代码,我得到了下面的结果为Hello Rithwik

现在,我已经使用您输入我的代码,我得到了下面的错误UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9d in position 54: invalid start byte

import base64
en = "  UEsDBBQACAgIAEBPY1YAAAAAAAAAAAAAAAAYAAAAeGwvZHJhd2luZ3MvZHJhd2luZzEueG1sndBdbsIwDAfwE+wOVd5pWhgTQxRe0E4wDuAlbhuRj8oOo9x+0Uo2aXsBHm3LP/nvzW50tvhEYhN8I+qyEgV6FbTxXSMO72+zlSg4gtdgg8dGXJDFbvu0GTWtz7ynIu17XqeyEX2Mw1pKVj064DIM6NO0DeQgppI6qQnOSXZWzqvqRfJACJp7xLifJuLqwQOaA+Pz/k3XhLY1CvdBnRz6OCGEFmL6Bfdm4KypB65RPVD8AcZ/gjOKAoc2liq46ynZSEL9PAk4/hr13chSvsrVX8jdFMcBHU/DLLlDesiHsSZevpNlRnfugbdoAx2By8i4OPjj3bEqyTa1KCtssV7ercyzIrdfUEsHCAdiaYMFAQAABwMAAFBLAwQUAAgICABAT2NWAAAAAAAAAAAAAAAAGAAAAHhsL2RyYXdpbmdzL2RyYXdpbmcyLnhtbJ3QXW7CMAwH8BPsDlXeaVoYE0MUXtBOMA7gJW4bkY/KDqPcftFKNml7AR5tyz/5781udLb4RGITfCPqshIFehW08V0jDu9vs5UoOILXYIPHRlyQxW77tBk1rc+8pyLte16nshF9jMNaSlY9OuAyDOjTtA3kIKaSOqkJzkl2Vs6r6kXyQAiae8S4nybi6sEDmgPj8/5N14S2NQr3QZ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0QEAAOgEAAAYAAAAAAAAAAAAAAAAAJYCAAB4bC93b3Jrc2hlZXRzL3NoZWV0MS54bWxQSwECFAAUAAgICABAT2NWrajrTbMAAAAqAQAAIwAAAAAAAAAAAAAAAACtBAAAeGwvd29ya3NoZWV0cy9fcmVscy9zaGVldDEueG1sLnJlbHNQSwECFAAUAAgICABAT2NW1k1zMMMBAABsBAAAGAAAAAAAAAAAAAAAAACxBQAAeGwvd29ya3NoZWV0cy9zaGVldDIueG1sUEsBAhQAFAAICAgAQE9jVoUB9RW0AAAAKgEAACMAAAAAAAAAAAAAAAAAugcAAHhsL3dvcmtzaGVldHMvX3JlbHMvc2hlZXQyLnhtbC5yZWxzUEsBAhQAFAAICAgAQE9jVmWjgWEoAwAArQ4AABMAAAAAAAAAAAAAAAAAvwgAAHhsL3RoZW1lL3RoZW1lMS54bWxQSwECFAAUAAgICABAT2NWhpnahZoAAADJAAAAFAAAAAAAAAAAAAAAAAAoDAAAeGwvc2hhcmVkU3RyaW5ncy54bWxQSwECFAAUAAgICABAT2NWQZwdZw8CAACmBgAADQAAAAAAAAAAAAAAAAAEDQAAeGwvc3R5bGVzLnhtbFBLAQIUABQACAgIAEBPY1adyLt5UQEAAGQDAAAPAAAAAAAAAAAAAAAAAE4PAAB4bC93b3JrYm9vay54bWxQSwECFAAUAAgICABAT2NWP/Ios/IAAABGAwAAGgAAAAAAAAAAAAAAAADcEAAAeGwvX3JlbHMvd29ya2Jvb2sueG1sLnJlbHNQSwECFAAUAAgICABAT2NWpG+hILIAAAAoAQAACwAAAAAAAAAAAAAAAAAWEgAAX3JlbHMvLnJlbHNQSwECFAAUAAgICABAT2NWUVPs0z8BAAAZBQAAEwAAAAAAAAAAAAAAAAABEwAAW0NvbnRlbnRfVHlwZXNdLnhtbFBLBQYAAAAADQANAHcDAACBFAAAAAA="
db = base64.b64decode(en)
de = db.decode("utf-8")
print(de) 
eb = de.encode("utf-8")
en = base64.b64encode(eb).decode("utf-8")
print(en)

所以,据我所知,问题出在你的输入上。所以试着把你的输入改变成所需的格式,然后用我的代码检查。你会得到和我一样的输出。

相关问题