fileManager module¶
-
class
fileManager.fileManager¶ Bases:
objectThis is a class that manages files and also allows the downloading, seaching and deleting of files.
-
authDownload(URL, username, password, outName)¶ Downloads the file from a website that requires authentication, and stores the file in the USB.
- Parameters
URL (string) – is the url that points to the file that is to be downladed.
username (string) – This is the username that the individual uses to login to a website
password (string) – This is the password the individual uses to login to a file.
outName (string) – This is the name of the file that the individual is downloading.
-
deleteFile(fName)¶ searches for the fileName and deletes it from the usb module
- Parameters
fName (string) – [ The name of the file that is being searched, the name should include its file type at the end]
- Returns
The name of result of deleting for the file using find command on a linux terminal, if one of the parameters given are wrong it returns an empty string
- Return type
string
-
donwloadFile(URL, fName, fType)¶
-
obtainName(nameList)¶ Obtains the name of the file from the url
- Parameters
nameList (string) – The
nameListargument represent the url list returned thespliturl(self,url)function- Returns
The name of file that URL in the nameList points to, if one of the parameters given are wrong it returns an empty string
- Return type
string
-
obtainType(nameList)¶ Obtains the type of the file that the link points to
- Parameters
nameList (strimg) – The
nameListargument represent the url list returned thespliturl(self,url)function- Returns
The type of file that URL in the nameList points to, if one of the parameters given are wrong it returns an empty string
- Return type
string
-
searchFile(fName)¶ searches for the fileName in the usb module.
- Parameters
fName (string) – The name of the file that is being searched
- Returns
The name of result of searching for the file using find command on a linux terminal, if one of the parameters given are wrong it returns an empty string
- Return type
string
-
splitUrl(url)¶ Takes a url, splites it to and splits it to get the file type and also obtains the name of the file from the url.
- Parameters
url (string) – nameList (list): Takes in a
urlof the document to be downloaded.- Returns
returns a list where the contents are the strings in the url that are seperated by a backslash
/. or If the string has no backslash/decilimator it returnsinvalid URL given- Return type
list
-