Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review and update example code in README #22

Open
richarda23 opened this issue Jan 23, 2022 · 1 comment
Open

Review and update example code in README #22

richarda23 opened this issue Jan 23, 2022 · 1 comment

Comments

@richarda23
Copy link

  • add some examples of Inventory API
  • make sure all snippets work with v2
@burgerga
Copy link

burgerga commented Feb 8, 2023

I was trying out some examples from the README:

  • https://github.com/rspace-os/rspace-client-python#a-basic-query-to-list-documents

    AttributeError: module 'rspace_client' has no attribute 'Client'

    Should probably be ELNClient

  • https://github.com/rspace-os/rspace-client-python#getting-attached-files

    Doesn't work for me; long 404 error on the line

    download_metadata_link = client.get_link_contents(file, 'self')

    What does work is

    document_id = 17828 #< replace with own doc_id
    try:
        response = client.get_document(doc_id = document_id)
    except ValueError:
        print('Document with id %s not found' % str(document_id))
        
    for field in response['fields']:
        for file in field['files']:
            filename = '/tmp/' + file['name']
            print('Downloading to file', filename)
            client.download_link_to_file(client.get_link(file, 'enclosure'), filename)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants