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

eelsdb blocks requests bugfix #66

Merged
merged 4 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Citing eXSpy

If eXSpy has been significant to a project that leads to an academic
publication, please acknowledge that fact by citing it. The DOI in the
badge below is the `Concept DOI <https://help.zenodo.org/faq/#versioning>`_ of
badge below is the `Concept DOI <https://support.zenodo.org/help/en-gb/1-upload-deposit/97-what-is-doi-versioning>`_ of
eXSpy. It can be used to cite the project without referring to a specific
version. If you are citing eXSpy because you have used it to process data,
please use the DOI of the specific version that you have employed. You can
Expand Down
12 changes: 10 additions & 2 deletions exspy/misc/eels/eelsdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,14 @@ def eelsdb(
if show_progressbar is None:
show_progressbar = preferences.General.show_progressbar

headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
}
request = requests.get(
"https://api.eelsdb.eu/spectra", params=params, verify=verify_certificate
"https://api.eelsdb.eu/spectra",
params=params,
verify=verify_certificate,
headers=headers,
)
spectra = []
jsons = request.json()
Expand All @@ -271,7 +277,9 @@ def eelsdb(
f"Permalink: {json_spectrum['permalink']}"
)
continue
msa_string = requests.get(download_link, verify=verify_certificate).text
msa_string = requests.get(
download_link, verify=verify_certificate, headers=headers
).text
try:
s = dict2signal(parse_msa_string(msa_string)[0])
emsa = s.original_metadata
Expand Down
1 change: 1 addition & 0 deletions upcoming_changes/66.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix blocked eelsdb queries