Skip to content

Commit

Permalink
Added CDS token
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnestaP committed Apr 24, 2024
1 parent 39bd717 commit ee90d04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions dags/open_access/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
def get_url(query, current_collection="Published+Articles"):
url = (
rf"https://cds.cern.ch/search?ln=en&cc={current_collection}&p={query}"
+ rf"&apikey={os.environ.get('CDS_TOKEN')}"
+ r"&action_search=Search&op1=a&m1=a&p1=&f1=&c="
+ r"Published+Articles&c=&sf=&so=d&rm=&rg=100&sc=0&of=xm"
)
token = os.environ.get("CDS_TOKEN")
if token:
url = url + rf"&apikey={token}"
return url


Expand All @@ -26,7 +28,7 @@ def request_again_if_failed(url):
count = count + 1
response = requests.get(url)
if response.status_code != 200:
raise DataFetchError(urls=url, status_code=response.status_code)
raise DataFetchError(url=url, status_code=response.status_code)
return response


Expand Down
12 changes: 6 additions & 6 deletions tests/integration/cassettes/test_golden_access_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232176,14 +232176,14 @@ interactions:
Content-Type:
- text/xml
Date:
- Wed, 24 Apr 2024 13:12:05 GMT
- Wed, 24 Apr 2024 14:02:34 GMT
Keep-Alive:
- timeout=15, max=100
Server:
- Apache
Set-Cookie:
- INVENIOSESSIONstub=NO; path=/; HttpOnly
- INVENIOSESSION=badac70fc6cd1f407831c2b028855c3b; path=/; HttpOnly
- INVENIOSESSION=0004ca7f17e1bfd2576d05a17149cebe; path=/; HttpOnly
Transfer-Encoding:
- chunked
Vary:
Expand Down Expand Up @@ -464370,14 +464370,14 @@ interactions:
Content-Type:
- text/xml
Date:
- Wed, 24 Apr 2024 13:12:10 GMT
- Wed, 24 Apr 2024 14:02:52 GMT
Keep-Alive:
- timeout=15, max=100
Server:
- Apache
Set-Cookie:
- INVENIOSESSIONstub=NO; path=/; HttpOnly
- INVENIOSESSION=e12769bfe459ea264bdf0425d886b744; path=/; HttpOnly
- INVENIOSESSION=c86db7441827e64ff96bc960c2e5b2ab; path=/; HttpOnly
Transfer-Encoding:
- chunked
Vary:
Expand Down Expand Up @@ -530753,14 +530753,14 @@ interactions:
Content-Type:
- text/xml
Date:
- Wed, 24 Apr 2024 13:12:17 GMT
- Wed, 24 Apr 2024 14:02:57 GMT
Keep-Alive:
- timeout=15, max=100
Server:
- Apache
Set-Cookie:
- INVENIOSESSIONstub=NO; path=/; HttpOnly
- INVENIOSESSION=5cdab080f5e53348a3d3f987678e653c; path=/; HttpOnly
- INVENIOSESSION=0c291b6e84acd207bc8431d4bf6604ec; path=/; HttpOnly
Transfer-Encoding:
- chunked
Vary:
Expand Down

0 comments on commit ee90d04

Please sign in to comment.