diff --git a/dags/open_access/utils.py b/dags/open_access/utils.py index c48133b..08dfc2d 100644 --- a/dags/open_access/utils.py +++ b/dags/open_access/utils.py @@ -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 @@ -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 diff --git a/tests/integration/cassettes/test_golden_access_request.yaml b/tests/integration/cassettes/test_golden_access_request.yaml index 4373cfe..f2fcd56 100644 --- a/tests/integration/cassettes/test_golden_access_request.yaml +++ b/tests/integration/cassettes/test_golden_access_request.yaml @@ -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: @@ -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: @@ -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: