-
Notifications
You must be signed in to change notification settings - Fork 1
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
SFR-2288 Querying by OCLC Number uses metadata API MARCXML endpoint #464
Conversation
@@ -16,7 +16,7 @@ class OCLCAuthManager: | |||
_metadata_token = None | |||
_metadata_token_expires_at = None | |||
OCLC_SEARCH_AUTH_URL = 'https://oauth.oclc.org/token?scope=wcapi&grant_type=client_credentials' | |||
OCLC_METADATA_AUTH_URL = 'https://oauth.oclc.org/token?scope=WorldCatMetadataAPI&grant_type=client_credentials' | |||
OCLC_METADATA_AUTH_URL = 'https://oauth.oclc.org/token?scope=WorldCatMetadataAPI:view_marc_bib&grant_type=client_credentials' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
mappings/oclcCatalog.py
Outdated
def remove_oclc_prefixes(self, oclc_id): | ||
return oclc_id.removeprefix('(OCoLC)').removeprefix('on').removeprefix('ocn').removeprefix('ocm') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend pulling up prefixes into a set or list above as a constant, e.g. OCLC_PREFIXES = ['(OCoLC)', 'on', 'ocn', 'ocm'].
That way we can just do:
for prefix in OCLC_PREFIXES:
oclc_id = oclc_id.removeprefix(prefix)
In theory ha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Overall looks great - just 1 minor function improvement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Tested with the SeedLocalData process and fields were manually compared -- after removing OCLC control number prefixes, they now look comparable at a glance.