CkPython
CkPython
Ungzip Base64 String
See more Gzip Examples
Suppose you have a gzip in base64 representation that contains a text file, such as XML. This example shows how to decompress and access the string.Chilkat CkPython Downloads
import sys
import chilkat
success = False
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
gzip = chilkat.CkGzip()
gzipBase64 = "H4sIAAAAAAAE ... X6aZjXO3EwAA"
bd = chilkat.CkBinData()
success = bd.AppendEncoded(gzipBase64,"base64")
success = gzip.UncompressBd(bd)
if (success != True):
print(gzip.lastErrorText())
sys.exit()
strXml = bd.getString("utf-8")
print("XML:")
print(strXml)