Reading and writing base64-encoded data. More...
Classes | |
| class | DecodingError |
| Raised when reading invalid or unterminated base64-encoded data. More... | |
Functions | |
| def | encode |
| Write a binary string to a file in base64 representation. More... | |
| def | decode |
| Read a string in base64 representation from a file. More... | |
Variables | |
| string | BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' |
| string | PAD64 = '=' |
| list | RANK |
Reading and writing base64-encoded data.
| def xorn.base64.decode | ( | f, | |
delim = None |
|||
| ) |
Read a string in base64 representation from a file.
This function is liberal in what it will accept. It ignores non-base64 symbols.
If delim is None, read until the end of the file. If delim is not None, read until a line containing exactly delim is found.
| DecodingError | if reading something that is not valid base64-encoded data |
| DecodingError | if the end of the file is hit and delim is not None |
| def xorn.base64.encode | ( | f, | |
| src, | |||
columns = 72, |
|||
delim = None |
|||
| ) |
Write a binary string to a file in base64 representation.
If columns is not None, insert a newline every columns characters. This is required by RFC 2045, but some applications don't require it. columns must positive and a multiple of 4.
If delim is not None, it is written on a separate line after the data. This argument is provided for symmetry with decode.
None. | string xorn.base64.BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' |
| list xorn.base64.RANK |
1.8.8