예제 #1
0
def get_file_id(filelistno):
	dom = rootdom
	try:
		fileid = dom.getElementsByTagName('file')[int(filelistno)].getElementsByTagName('id')[0].toxml().replace('<id>', '').replace('</id>', '')
	except:
		errprint("file might not exsist")
	return fileid
예제 #2
0
def get_file_id(filelistno):
    dom = rootdom
    try:
        fileid = dom.getElementsByTagName('file')[int(
            filelistno)].getElementsByTagName('id')[0].toxml().replace(
                '<id>', '').replace('</id>', '')
    except:
        errprint("file might not exsist")
    return fileid
예제 #3
0
def upload(filepath, filename, folderid):
	infoprint("Uploading...")
	url = build_url("file", "content", None)
	payload = {'filename1': filename, 'folder_id': folderid}
	try:
		data = {filename: open(filepath, 'r')}
	except:
		errprint("File selected is not a file or other error")
		return
	r = requests.post(url=url, data=payload, headers=headers, files=data, proxies=proxies)
예제 #4
0
def get_all_file_id():
	dom = rootdom
	cnt = int(dom.getElementsByTagName('total-count')[0].toxml().replace('<total-count>', '').replace('</total-count>', ''))
	fileid={}
	i=0
	while i<=cnt:
		try:
			fileid[i] = dom.getElementsByTagName('file')[i].getElementsByTagName('id')[0].toxml().replace('<id>', '').replace('</id>', '')
			i=i+1
		except:
			errprint("file might not exist")
			i=cnt+5
	return fileid
예제 #5
0
def upload(filepath, filename, folderid):
    infoprint("Uploading...")
    url = build_url("file", "content", None)
    payload = {'filename1': filename, 'folder_id': folderid}
    try:
        data = {filename: open(filepath, 'r')}
    except:
        errprint("File selected is not a file or other error")
        return
    r = requests.post(url=url,
                      data=payload,
                      headers=headers,
                      files=data,
                      proxies=proxies)
예제 #6
0
def get_all_file_id():
    dom = rootdom
    cnt = int(
        dom.getElementsByTagName('total-count')[0].toxml().replace(
            '<total-count>', '').replace('</total-count>', ''))
    fileid = {}
    i = 0
    while i <= cnt:
        try:
            fileid[i] = dom.getElementsByTagName(
                'file')[i].getElementsByTagName('id')[0].toxml().replace(
                    '<id>', '').replace('</id>', '')
            i = i + 1
        except:
            errprint("file might not exist")
            i = cnt + 5
    return fileid