Ejemplo n.º 1
0
 def upload_file(self, src, dst):
     try:
         dst_parts = dst.split('/')
         file = dst_parts.pop()
         path = '/'.join(dst_parts) + '/'
         client = Client()
         client.send_file(self.__create_connection__(path), file, src)
     except Exception as e:
         print e
         pass
Ejemplo n.º 2
0
 def download_file(self, src, dst):
     try:
         src_parts = src.split('/')
         file = src_parts.pop()
         path = '/'.join(src_parts) + '/'
         client = Client()
         client.get_file(self.__create_connection__(path), file, dst)
         f = open(dst)
         file_data = f.read()
         if '404 Not Found' in file_data:
             os.remove(dst)
             return None
         else:
             return dst
     except Exception as e:
         print e
         pass