From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,NO_DNS_FOR_FROM, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from [192.168.1.2] (unknown [101.128.125.123]) by gnuweeb.org (Postfix) with ESMTPSA id 5683280908; Fri, 21 Oct 2022 14:02:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1666360961; bh=PUbEJFLd2qHllyIf9Uv93lsJ+ZGgGD30iScAy3Wf9s0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=OQ3xyyyKDJVPNww39q0nfaKslOnWdqxjdMrko4+I65+upvBpQPGjRGO4Jc/XWVDvg GNfl24DbfpDPaI62TfN5yPXp8YnNX+PbxOUDMRovCJlrmDZaf2UhGogY7fjWEagmK1 vSzM/P87HX7cOioIl6p5IxH9l7iewo2myP85IP5R8Pbvh9YcH3FJ4juO6UCN+UJbRy KPe55d8/MS64l0lZJ8iSGXptZSBRXDPVQQMlecbVlGpB4ljfIYfzXQOqONsubGzhg6 K/o6RUDvxBG3H6Ba+NKGehRicc9R4uSUQIL7ZdzTugAkValHXjiY3Me7zBiZ8ctjHX B0Qb8EJ+7rSEA== Message-ID: Date: Fri, 21 Oct 2022 21:02:36 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v3 5/9] atom: add manage_payload() To: Ammar Faizi Cc: Alviro Iskandar Setiawan , GNU/Weeb Mailing List References: <20221021134520.701-1-kiizuha@gnuweeb.org> <20221021134520.701-6-kiizuha@gnuweeb.org> <6a9ebeeb-9227-96bb-a8d5-caceb54e54ca@gnuweeb.org> Content-Language: en-US From: Muhammad Rizki In-Reply-To: <6a9ebeeb-9227-96bb-a8d5-caceb54e54ca@gnuweeb.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: On 21/10/2022 21.01, Ammar Faizi wrote: > On 10/21/22 8:45 PM, Muhammad Rizki wrote: >> +def manage_payload(payload: Message): >> +    p = str(payload.get_payload()) >> +    tf_encode = payload.get("Content-Transfer-Encoding") >> + >> +    if tf_encode == "base64": >> +        return b64decode(p).decode("utf-8") >> +    if tf_encode == "quoted-printable": >> +        return quopri.decodestring(p.encode()).decode() >> + >> +    return p.encode().decode("utf-8", errors="replace") > > I don't feel strongly about this helper name. What about name it > with get_decoded_paylaod()? > Sure, or just decode_payload()?