From f2f892cb8349ad9d3e48c2677e033e0384b29309 Mon Sep 17 00:00:00 2001 From: Paco Nathan Date: Wed, 1 Apr 2020 13:49:58 -0700 Subject: [PATCH] prep 1.2.0 release --- README.md | 10 +++++----- changelog.txt | 6 ++++-- example.py | 18 +++++++++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index ebc31ea..ec7941c 100644 --- a/README.md +++ b/README.md @@ -87,15 +87,15 @@ title = "Deal or no deal? The prevalence and nutritional quality of price promot # run it... if source.has_credentials(): - meta, timing, message = source.title_search(title) + response = source.title_search(title) # report results - if message: + if response.message: # error case - print(message) + print(response.message) else: - print(meta) - source.report_perf(timing) + print(response.meta) + source.report_perf(response.timing) ``` diff --git a/changelog.txt b/changelog.txt index 1f0c2d6..0749a6d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,9 +2,11 @@ ## 1.2.0 -2020-0?-?? +2020-04-01 - - wrapped most API results in response objects + - *THIS RELEASE WILL BREAK MANY THINGS* + + - wrapped API results in response objects (except not RePEc) - `title_search()` for REPEC, Crossref, Pubmed fails more gracefully diff --git a/example.py b/example.py index f416c05..c9c78b6 100755 --- a/example.py +++ b/example.py @@ -36,18 +36,18 @@ # run it... if source.has_credentials(): - #meta, timing, message = source.title_search(title) - meta, timing, message = source.full_text_search(search_term, limit=13, exact_match=False) + responses = source.full_text_search(search_term, limit=13, exact_match=True) - # report results - if message: - # error case - print(message) - else: - print(json.dumps(meta, indent=4, ensure_ascii=False)) + # report results + if responses[0].message: + # error case + print(responses[0].message) + else: + for r in responses: + print(json.dumps(r.meta, indent=4, ensure_ascii=False)) # report performance - source.report_perf(timing) + source.report_perf(responses[0].timing) if enable_profiling: schol.stop_profiling(pr)