NetCode Class

Properties   Methods   Events   Configuration Settings   Errors  

The NetCode class can be used to encode or decode files or strings using a variety of popular encoding formats such as: Base64, UUencode, URL, etc. UUEncode , MIME's Base64 Quoted-Printable , URL encoding formats, as well as secure hash functions such as MD5 and SHA1, are currently supported.

Syntax

class ipworks.NetCode

Remarks

The encoding format is specified by the format property. The binary data, or the name of the file containing binary data, is specified by the decoded_data property and the encoded data or filename is specified by the encoded_data property. The file_name property may be used to override the default file names or to specify a directory during uuencoding. After uudecoding, the file_name property contains the fully specified file name of the decoded file.

Understanding Encoding/Decoding

Most of mail systems use only 7 bits to transmit messages. A binary file such as an archive or a non-plain text formatted file produced from a text processor should be first encoded in 7 bit code before email transfer.

Decoding is the inverse process: creation of the original file from the encoded data. Encoded data is often split over several files because of the size limit placed on the email message. Each message is preceded by information about this splitting, as well as the mail header. NetCode supports this case in both directions:

- During encoding setting the MaxFileSize config setting to the maximum size of a message body instructs NetCode to split the encoded data over several files. Multiple filenames can be specified by using question marks "?" (See the encoded_data property for more information).

- During decoding, the body messages can be saved in separate files named namexxx.ext where xxx is a numeral starting at 000 and ext is ".uue", ".b16", or ".q_p" according to format. These multiple filenames should be given to encoded_data.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

decoded_dataThe decoded data.
decoded_fileThe filename of the decoded data.
encoded_dataThe encoded data.
encoded_fileFilename of the encoded data.
file_cntShows the number of encoded files the class has read from or written into.
file_nameThe destination filename for the encoded data.
formatThe type of encoding to be used.
modeThe UNIX-style filemode when uuencoding / uudecoding.
overwriteControls whether created file(s) should overwrite already existing file(s).
progress_stepControls the granularity at which the Progress event is fired. Values 0-100.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

configSets or retrieves a configuration setting.
decodeDecode string.
encodeEncode the data.
resetReset the class.
reset_dataResets the values of all data and stream properties.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_errorInformation about errors during data delivery.
on_progressOccurs when PercentDone of the input is read.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

Base64LineBreakTells the class whether to include line breaks in Base64 encoded content or not.
EncodeHashWhether the hash value is hex encoded.
HMACAlgorithmThe hash algorithm to use when generating a Hash-based Message Authentication Code (HMAC).
HMACKeyA key to use when generating a Hash-based Message Authentication Code (HMAC).
MaxFileSizeWhen encoding, controls whether encoded data should be split into several files and gives the maximum allowed size for these files.
UseExtendedHexBase32Specifies whether or not the Extended Hex alphabet is used.
UseModifiedUTF7Specifies whether or not a modified form of UTF-7 for IMAP mailbox naming is used.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks 2020 Python Edition - Version 20.0 [Build 8307]