-
Notifications
You must be signed in to change notification settings - Fork 47
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
Does not support quotes in the query string #98
Comments
@janakanuwan I tried reproducing the issue but couldn’t get the same error on my end. Does it still happen for you? This works for me: from semanticscholar import SemanticScholar
sch = SemanticScholar()
results = sch.search_paper('Computing Machinery + (Intelligence | Intel*)', bulk=True)
print(f'Total results: {results.total}')
print(f'First result: {results[0].title}') Output: Total results: 806
First result: The Teaching of Psychological Medicine Line 127 in ApiRequester.py handles responses with a 400 status (Bad Query Parameters). Maybe the service returned an invalid JSON for some reason. |
@danielnsilva I think the issue is with passing the JSON after receiving the response, which includes the original query, which may not follow JSON format by default when it has double quotes. Can you try using double quotes that enable phases, such as |
This also works for me: from semanticscholar import SemanticScholar
sch = SemanticScholar()
results = sch.search_paper('"Computing Machinery" + Intelligence', bulk=True)
print(f'Total results: {results.total}')
print(f'First result: {results[0].title}') Output: Total results: 311
First result: A Comparative Study of Multilingual Translation Using Generative AI Translators and Human Translators : Alan Turning:‘Computing Machinery and Intelligence' What version of |
@danielnsilva I am using conda environment on Windows and using;
|
It seems like this issue only happens with version 0.27 of HTTPX. I tested with 0.26 and 0.28 on both Linux and Windows, and they worked fine, but it fails with version 0.27. That said, there’s no handling for query parameters in the code right now, so using the params argument, as suggested in PR #99, might be a better approach.
@janakanuwan What do you mean by "this may remove the original query in resulting response object"? |
@danielnsilva I mean earlier, the `class PaginatedResults:
|
FIX:Does not support quotes in the query string #98
Bug description
JSON decode errors occur when the query parameter has double quotes or other binary operators
Reproducible code example
Error message
Package version
0.8.4
Python version
3.11.10
The text was updated successfully, but these errors were encountered: