Skip to content
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

Inquiry about setting options for HTTP/HTTPS #156

Closed
ezphyki opened this issue Mar 18, 2024 · 1 comment
Closed

Inquiry about setting options for HTTP/HTTPS #156

ezphyki opened this issue Mar 18, 2024 · 1 comment
Labels
question Questions about how to use this package.

Comments

@ezphyki
Copy link

ezphyki commented Mar 18, 2024

When making requests to a site using both HTTP and HTTPS, HTTP requests work fine, while HTTPS requests show 0 results. Is there an option to configure HTTP/HTTPS settings? I'm curious about the method.

HTTP request
http://export.arxiv.org/api/query?search_query=all%3A%22security%22+AND+submittedDate%3A%5B20240301%2A+TO+20240316%2A%5D&id_list=&sortBy=submittedDate&sortOrder=descending&start=0&max_results=100

HTTPS request
https://export.arxiv.org/api/query?search_query=all%3A%22security%22+AND+submittedDate%3A%5B20240301%2A+TO+20240316%2A%5D&id_list=&sortBy=submittedDate&sortOrder=descending&start=0&max_results=100

@ezphyki ezphyki added the question Questions about how to use this package. label Mar 18, 2024
@lukasschwab
Copy link
Owner

Differing HTTP vs. HTTPS results are a tell-tale sign of flakiness in the underlying API: #129 Unfortunately (judging by the volume of reports here) this issue seems to have become more frequent in recent months.

HTTP vs. HTTPS isn't directly configurable via the client constructor, but you can modify the base URL stored on the Client:

>>> import arxiv
>>> c = arxiv.Client()
>>> c.query_url_format
'https://export.arxiv.org/api/query?{}'
>>> c.query_url_format = 'http://export.arxiv.org/api/query?{}' # Switch to HTTP
>>> c.query_url_format
'http://export.arxiv.org/api/query?{}'

Subsequent calls with that client c will use the HTTP endpoint.

Of course, all the typical cautions re. using HTTP over HTTPS apply here, and I'm not confident switching will produce reliably correct results for your use case. As I write this, the HTTP API returns an empty result set for the query "quantum" (correctly non-empty for the HTTPS endpoint).

@ezphyki ezphyki closed this as completed Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions about how to use this package.
Projects
None yet
Development

No branches or pull requests

2 participants