[Python] Python requests HTTP PUT results in ChunkedEncodingError

Discussão em 'Python' iniciado por Stack, Outubro 23, 2024.

  1. Stack

    Stack Membro Participativo

    When executing the code below, the ChunkedEncodingError is always raised. Why could this be?

    try:
    r = requests.put(
    url,
    data=payload, # encodings.utf_8.encode(payload)[0],
    headers={
    'Content-Type': 'application/json; charset=utf-8',
    'Accept': 'application/json',
    'Accept-Charset': 'UTF-8',
    'Accept-Encoding': '*', # 'deflate, gzip, compress, br, zstd, identity'
    },
    auth=HTTPDigestAuth(
    access_obj['pubKey'],
    access_obj['privKey']
    ),
    stream=False
    )
    except ChunkedEncodingError as ex:
    print(f"Invalid chunk encoding {str(ex)}")

    Continue reading...

Compartilhe esta Página