예제 #1
0
def update_osf_file(file, new_content_file_name, nid):

    params = {'path': file['path'], 'provider': 'osfstorage', 'nid': nid}
    files_url = wb_file_url()
    path_to_file_with_new_content = os.path.join(files_directory,
                                                 new_content_file_name)
    content = open(path_to_file_with_new_content, 'rb')
    resp = session.put(files_url, params=params, data=content)
    assert resp.ok
    return resp.json()
예제 #2
0
def create_osf_folder(folder_name, nid, parent=None):
    if parent:
        path = parent['path'] + folder_name
    else:
        path = '/{}'.format(folder_name)
    params = {'path': path, 'provider': 'osfstorage', 'nid': nid}
    files_url = wb_file_url()

    resp = session.post(files_url, params=params)

    assert resp.ok
    return resp.json()
예제 #3
0
def create_osf_file(file_name, nid, parent=None):
    if parent:
        path = parent['path'] + file_name
    else:
        path = '/{}'.format(file_name)
    params = {'path': path, 'provider': 'osfstorage', 'nid': nid}
    files_url = wb_file_url()
    path_to_file = os.path.join(files_directory, file_name)
    file = open(path_to_file, 'rb')
    resp = session.put(files_url, params=params, data=file)
    assert resp.ok
    return resp.json()
예제 #4
0
def update_osf_file(file,new_content_file_name, nid):

    params = {
        'path': file['path'],
        'provider': 'osfstorage',
        'nid': nid
    }
    files_url = wb_file_url()
    path_to_file_with_new_content = os.path.join(files_directory, new_content_file_name)
    content = open(path_to_file_with_new_content, 'rb')
    resp = session.put(files_url, params=params, data=content)
    assert resp.ok
    return resp.json()
예제 #5
0
def create_osf_file(file_name, nid, parent=None):
    if parent:
        path = parent['path'] + file_name
    else:
        path = '/{}'.format(file_name)
    params = {
        'path': path,
        'provider': 'osfstorage',
        'nid': nid
    }
    files_url = wb_file_url()
    path_to_file = os.path.join(files_directory, file_name)
    file = open(path_to_file, 'rb')
    resp = session.put(files_url, params=params, data=file)
    assert resp.ok
    return resp.json()
예제 #6
0
def create_osf_folder(folder_name, nid, parent=None):
    if parent:
        path = parent['path'] + folder_name
    else:
        path = '/{}'.format(folder_name)
    params = {
        'path': path,
        'provider': 'osfstorage',
        'nid': nid
    }
    files_url = wb_file_url()

    resp = session.post(files_url,params=params)

    assert resp.ok
    return resp.json()
예제 #7
0
def _delete_all_remote():
    remote_file_folders = get_node_file_folders(nid1)
    for file_folder in remote_file_folders:
        url = wb_file_url(path=file_folder.id, nid=nid1, provider='osfstorage')
        resp = session.delete(url)
        resp.close()
예제 #8
0
def delete_osf_file_folder(file_folder, nid):
    # http://localhost:7777/file?path=/&nid=dz5mg&provider=osfstorage
    url = wb_file_url(path=file_folder['path'], nid=nid, provider='osfstorage')
    resp = session.delete(url)
    resp.close()
예제 #9
0
def _delete_all_remote():
    remote_file_folders = get_node_file_folders(nid1)
    for file_folder in remote_file_folders:
        url = wb_file_url(path=file_folder.id,nid=nid1,provider='osfstorage')
        resp = session.delete(url)
        resp.close()
예제 #10
0
def delete_osf_file_folder(file_folder, nid):
    # http://localhost:7777/file?path=/&nid=dz5mg&provider=osfstorage
    url = wb_file_url(path=file_folder['path'],nid=nid,provider='osfstorage')
    resp = session.delete(url)
    resp.close()