sckott / habanero

client for Crossref search API
https://habanero.readthedocs.io
MIT License
207 stars 30 forks source link

Can't make field queries request #150

Closed wisentini closed 10 months ago

wisentini commented 10 months ago

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?

sckott commented 10 months ago

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

sckott commented 10 months ago

@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")