A class to store data to a file
SocketStorage constructor
Param: |
|
---|
SocketStorage constructor
Param: |
|
---|
Methods
__init__(file_object) | SocketStorage constructor |
close() | Closes self.file if it exists, sets self.closed to True |
log_error(error[, message]) | Logs the error in bold red |
open(name) | Opens a file for writing |
read() | reads all the output and returns as a single string |
readline() | Calls a single read-line returns ‘timed out’ if socket.timeout |
write(text) | write text to a file |
writeline(text) | Adds newline to end of text and writes it to the file |
writelines(texts) | write lines to a file (does not add newline character to end of lines) |
Attributes
file |
|
||
logger |
|
Closes self.file if it exists, sets self.closed to True
Logs the error in bold red
Param: |
|
---|
Opens a file for writing
Param: |
|
---|---|
Returns: | copy of self with file as open file and closed set to False |
reads all the output and returns as a single string
Raise: | ApeError if socket times-out |
---|
Calls a single read-line returns ‘timed out’ if socket.timeout
reads all the output and returns a list of lines
Raise: | ApeError if the socket times out |
---|
write text to a file
Param: |
|
---|---|
Raise: | ApeError on socket.error |
Adds newline to end of text and writes it to the file
write lines to a file (does not add newline character to end of lines)
Param: |
|
---|---|
Raise: | ApeError on socket.error (socket closed) |
Returns: | opened file-like object |
---|
Returns: | A logging object. |
---|