Update Author Search to use official Author endpoint?
@mekarpeles is already working on this.
Since Jun 9, 2018.
- #92 by @mekarpeles — closed without merging
Assessment
This issue has not been assessed yet.
Description
@classmethod
def search(cls, name=None, birth_date=None, death_date=None, limit=5):
"""
Searches for an Open Library author by
Args:
name (str) - The first, last, nickname, or full name of the author
birth_date (str) - The birth date of the Author exactly as it appears in OL (e.g. "January 5, 2013").
Must be in quotes if the date is mult-terms, e.g. "\"January 5\""
You can also do something like "*1982*" without quotes to do
partial matching, e.g. on year.
date_date (str) - The death date of the Author; same conditions as birth_date
limit (int) - How many results to limit by
Usage:
>>> ol.common.Author.search(name='tolkien', birth_date="*1892*", death_date="*1973*")
[u'OL26320A]'
Returns:
The first matching OL Author ID/key from the API results, if there is one, else None
"""
params = {'name': name, 'birth_date': birth_date, 'death_date': death_date}
paramstr = '+'.join(['%s:%s' % (k, v) for (k, v) in params.items() if v])
url = cls.OL.base_url + '/search/authors.json?limit=%s&q=%s' % (limit, paramstr)
r = requests.get(url)
try:
authors = r.json().get('docs', [])
except requests.JSONDecodeError as e:
return []
return [a['key'] for a in authors]
@hornc, @cdrini thoughts? Not sure if the existing autocomplete code allows faceting by birth/death date
- Dominant language
- Python
- Stars
- 509
- Forks
- 116
- Avg merge
- 11d 8h
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from internetarchive/openlibrary-client
-
Add warning to readme about books creation not being possible.Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 62/100
-
ol batch: JSON batch/patch submission (create/add/submit) on the review-gated BookWorm pipelineOpen
Difficulty 5/5 Over a week Newbie friendliness 25/100
internetarchive/openlibrary-client#465 · 2 comments ·
-
CLI enhancement
Difficulty 4/5 Over a week Newbie friendliness 15/100
internetarchive/openlibrary-client#460 · 1 comment ·
-
Add `ol tag add` to tag every work matching a set of subjectsPossibly taken @mekarpeles claimed this 12 days ago. OpenCLI enhancement Works
internetarchive/openlibrary-client#458 · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
All issues in internetarchive/openlibrary-client
Similar issues
-
[Bug]: streaming_end_of_stream_only guardrails rescan the whole stream on every chunk - blocks event loopPossibly taken A pull request linked to this issue is open or already merged. Openbug llm translation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
arith ascend bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
tile-ai/tilelang#5173 · 2 comments · 1 reaction ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lanl/text-fetch#92 ·
Maintainers usually reply within 1 day
-
kind: for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
monumental-archive/.github#2284 ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
TanbirRamim/open-source-radar#761 ·
Maintainers usually reply within 1 day