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

Resolving invenio_server_name #39

Open
panta-123 opened this issue Jul 8, 2024 · 2 comments
Open

Resolving invenio_server_name #39

panta-123 opened this issue Jul 8, 2024 · 2 comments

Comments

@panta-123
Copy link

panta-123 commented Jul 8, 2024

Description

When I run iga -d -o <version>, I get:

 File "/Users/panta/invenio_github_archiver/venv/lib/python3.12/site-packages/iga/invenio.py", line 133, in invenio_server_name

This line: https://github.com/caltechlibrary/iga/blob/develop/iga/invenio.py#L130

It looks like data that my inveniordm server provides is:

{'hits': {'hits': [], 'total': 0}, 'aggregations': {'access_status': {'buckets': [], 'label': 'Access status'}, 'file_type': {'buckets': [], 'label': 'File type'}, 'resource_type': {'buckets': [], 'label': 'Resource types'}, 'target': {'buckets': [], 'label': 'target'}, 'beam': {'buckets': [], 'label': 'beam'}, 'division': {'buckets': [], 'label': 'Division'}, 'pac_status': {'buckets': [], 'label': 'Pac Status'}, 'pac_rating': {'buckets': [], 'label': 'Pac Rating'}}, 'sortBy': 'newest', 'links': {'self': 'https://vulcan.jlab.org/api/records?page=1&size=1&sort=newest'}}

data.get('hits', {}).get('hits') is a list and is empty meaning the line : https://github.com/caltechlibrary/iga/blob/develop/iga/invenio.py#L130 gives an error.

Solution idea:

On code bolck: https://github.com/caltechlibrary/iga/blob/develop/iga/invenio.py#L130-L135

        if response := network('get', server_url + endpoint):
            log(f'we can reach {server_url} and it responds to {endpoint}')
            data = response.json()
            record = data.get('hits', {}).get('hits', [])
            if record:
                 if publisher := record[0].get('metadata', {}).get('publisher'):
                       return publisher
            else:
               return server_host
              

Software environment

$ iga --version
iga version 1.3.0
Authors: Michael Hucka
URL: https://caltechlibrary.github.io/iga
License: https://github.com/caltechlibrary/iga/blob/main/LICENSE

@tmorrell
Copy link
Member

Thanks for the report; it's because your repo has no public records. I've created a PR #41 which will fix the issue, but we probably won't be able to get a release out for a few weeks.

@panta-123
Copy link
Author

Ah got it. I tried it on dev server after doing wipe and recreate. Thank you for quick fix.

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