In payload one value is as below to be converted this value to Gzip Compress in Python for REST API as we are using Python 2.7
Original Value:-
<ATTACHMENT_ID>ff38fac4-d962-49b1-843f-34d352b6ff49</ATTACHMENT_ID>0cc5e563-42e5-4e37-81ce-f25cc8756346<SF_OBJECT_ID>7d80f6ad-803b-475c-86b7-f10e28986df7</SF_OBJECT_ID><SF_OBJECT_TYPE>Agreement</SF_OBJECT_TYPE><SF_OBJECT_VERSION>1.0</SF_OBJECT_VERSION><SF_TEMPLATE_VERSION></SF_TEMPLATE_VERSION><SF_BUSINESS_OBJECT_CONTEXT>Agreement</SF_BUSINESS_OBJECT_CONTEXT>FalseFalse
To be converted to gzip compress
H4sIAAAAAAAACn2Sb2+CMBDGP1HHvwIlaUgQ62SZaEZntlcG2qsjEUoAZ/btByZOdNne3T33e55ek6NR08+12LS6gbYvoQtpxHkUL1cs5btkHirlEJULjGTg2QgHhYUIdhRysHRcu/CUwgE1bj10SDxWUPdDbQrhgus5CNvgIgyOj4glACnbFYL4wwR71JgY6AraPSS10iHdQtuVug6pca0m42yxW8+eWHx+1JfEVF4uETGdAmHfFYh4hY+UZYJNAuJJ5VPjxjIJ4O8bFkb7FmBcY8qdJxNyy16yZJ2G1oM5xS7ySHK22jxHnF3FEfytDuLsNUtSlmWXmHidcvbG71b5i6IcquaQ9zB+xpg2y7zLqrztkx6qcJEfOqDGjUZf4LOE02Orj00iB/ddvywlZB/6dHbEuu6HXWb6WMu8/foJ/I8ZjuL+tL4Bxmc3aG0CAAA=
I am able to do this using this link online - https://www.multiutil.com/text-to-gzip-compress/
I explored many options in python2.7 but was not able to get the exact format after encoding as mentioned above. I need the exact string as above after encoding.
I tried using the below code, but it is not giving me the required value after encoding
code = base64.b64encode(zlib.compress(compress, 9)) code = code.decode('utf-8')