Skip to content

Commit

Permalink
Use provider_id only when no client id
Browse files Browse the repository at this point in the history
So this is to always send a provider_id from the set, but only use it if we dont have a client_id
  • Loading branch information
richardhallett committed Nov 5, 2020
1 parent 292e891 commit b117ce9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions viringo/catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def listRecords(
provider_id, client_id = set_to_provider_client(set)
results, total_records, paging_cursor = datacite.get_metadata_list(
query=search_query,
provider_id=provider_id,
client_id=client_id,
from_datetime=from_,
until_datetime=until,
Expand Down Expand Up @@ -159,6 +160,7 @@ def listIdentifiers(
provider_id, client_id = set_to_provider_client(set)

results, total_records, paging_cursor = datacite.get_metadata_list(
provider_id=provider_id,
client_id=client_id,
from_datetime=from_,
until_datetime=until,
Expand Down
9 changes: 7 additions & 2 deletions viringo/services/datacite.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,17 @@ def get_metadata_list(

params = {
'detail': True,
'provider_id': provider_id,
'client_id': client_id,
'page[size]': config.RESULT_SET_SIZE,
'page[cursor]': cursor
}

# Only use the provider id if we dont have a client id
# Otherwise just send client_id
if not client_id:
params['provider_id'] = provider_id
else:
params['client_id'] = client_id

if datetime_query:
if query:
query = query + " AND " + datetime_query
Expand Down

0 comments on commit b117ce9

Please sign in to comment.