Skip to content

Commit

Permalink
Merge pull request #66 from PauTorru/eelsbd_headers
Browse files Browse the repository at this point in the history
eelsdb blocks requests bugfix
  • Loading branch information
ericpre authored Jul 11, 2024
2 parents e63bd21 + 7694c00 commit 04572ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
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

0 comments on commit 04572ec

Please sign in to comment.