Commit a6bd5070 authored by stas's avatar stas
Browse files

fix

parent 56a9300b
......@@ -6,6 +6,11 @@ import socket
import datetime
import configparser
import six
from six.moves.urllib import parse
import owncloud
class GetboxUploader:
'''
All my facebook operations
......@@ -27,16 +32,33 @@ class GetboxUploader:
uname = self.config['default']['UserName'].strip('"')
password = self.config['default']['Password'].strip('"')
import owncloud
oc = self.occlient = owncloud.Client('https://getbox.ispras.ru/')
oc = self.occlient = owncloud.Client('https://nextcloud.ispras.ru/')
oc.login(uname, password)
pass
def process(self, filename, getbox_folder):
if not os.path.exists(filename) and not os.path.exists(getbox_folder):
print(f'Looks like {filename} and {getbox_folder} not exists as local file')
if not os.path.exists(filename) and os.path.exists(getbox_folder):
# Missed filename and getbox_folder, need swap
filename, getbox_folder = getbox_folder, filename
print(f'Looks like you want put «{filename}» into «{getbox_folder}»')
filename_ = os.path.split(filename)[1]
ocpath = os.path.join(getbox_folder, filename_)
ocpath_terms = getbox_folder.split('/')[1:]
try:
print(ocpath_terms)
print(filename, "->", ocpath)
for i_ in range(1, len(ocpath_terms)+1):
predir = "/".join(ocpath_terms[:i_])
# print(f"trying to create dir {predir}")
try:
self.occlient.mkdir(predir)
except:
pass
self.occlient.put_file(ocpath, filename)
link_info = self.occlient.share_file_with_link(ocpath)
print(link_info.get_link())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment