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
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