sckott / habanero

client for Crossref search API

Home Page:https://habanero.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't make field queries request

wisentini opened this issue · comments

Environment

Python   3.8.18
habanero 1.2.3

Problem

I can't reproduce the request https://api.crossref.org/works?query.publisher-name=Universidade+Federal+de+Santa+Maria in habanero.

I've tried using both filter and query parameters when calling crossref.works(), but I can't get the same results.

Examples

# I get the error: "requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.crossref.org/works?filter=publisher-name%3AUniversidade+Federal+de+Santa+Maria&rows=1"
crossref.works(filter={'publisher_name': 'Universidade Federal de Santa Maria'}, limit=1)
# This works but I don't get the same results of calling https://api.crossref.org/works?query.publisher-name=Universidade+Federal+de+Santa+Maria
crossref.works(query='"publisher": "Universidade Federal de Santa Maria"', limit=1)

Question

How should I reproduce the request https://api.crossref.org/works?query.publisher-name=Universidade+Federal+de+Santa+Maria in habanero?

Thanks for the question @wisentini

Looks like Crossref has added new field queries. Just need to make a change to suppor those, will let you know when it's ready to test

@wisentini can you reinstall from github and test it out? let me know if it doesn't work for you. you should be able to do:

cr.works(query_publisher_name="Universidade Federal de Santa Maria")