From bcafd80794c6057bbe28c3b10b2b441c2ee59001 Mon Sep 17 00:00:00 2001 From: Sakan Nirattisaykul <94357278+sakan811@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:17:12 +0700 Subject: [PATCH 1/3] Update graphql_func.py --- backend/scraper/scraper_func/graphql_func.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/scraper/scraper_func/graphql_func.py b/backend/scraper/scraper_func/graphql_func.py index 8eef26d..9dc7d99 100644 --- a/backend/scraper/scraper_func/graphql_func.py +++ b/backend/scraper/scraper_func/graphql_func.py @@ -13,10 +13,17 @@ def get_header() -> dict: :return: Header as a dictionary. """ main_logger.info("Getting header...") - return { - "User-Agent": os.getenv("USER_AGENT") + headers = { + "User-Agent": os.getenv("USER_AGENT"), + "X-Booking-Context-Action-Name": os.getenv("X_BOOKING_CONTEXT_ACTION_NAME"), + "X-Booking-Context-Aid": os.getenv("X_BOOKING_CONTEXT_AID"), + "X-Booking-CSRF-Token": os.getenv("X_BOOKING_CSRF_TOKEN"), + "X-Booking-ET-Serialized-State": os.getenv("X_BOOKING_ET_SERIALIZED_STATE"), + "X-Booking-Pageview-Id": os.getenv("X_BOOKING_PAGEVIEW_ID"), + "X-Booking-Site-Type-Id": os.getenv("X_BOOKING_SITE_TYPE_ID"), + "X-Booking-Topic": os.getenv("X_BOOKING_TOPIC"), } - + return headers def check_currency_data(data) -> str: """ From bba24ea19406fed732ee6472ffbe7c3500800307 Mon Sep 17 00:00:00 2001 From: Sakan Nirattisaykul <94357278+sakan811@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:25:39 +0700 Subject: [PATCH 2/3] Update graphql_func.py --- backend/scraper/scraper_func/graphql_func.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/scraper/scraper_func/graphql_func.py b/backend/scraper/scraper_func/graphql_func.py index 9dc7d99..40bd0cd 100644 --- a/backend/scraper/scraper_func/graphql_func.py +++ b/backend/scraper/scraper_func/graphql_func.py @@ -15,13 +15,13 @@ def get_header() -> dict: main_logger.info("Getting header...") headers = { "User-Agent": os.getenv("USER_AGENT"), - "X-Booking-Context-Action-Name": os.getenv("X_BOOKING_CONTEXT_ACTION_NAME"), - "X-Booking-Context-Aid": os.getenv("X_BOOKING_CONTEXT_AID"), - "X-Booking-CSRF-Token": os.getenv("X_BOOKING_CSRF_TOKEN"), - "X-Booking-ET-Serialized-State": os.getenv("X_BOOKING_ET_SERIALIZED_STATE"), - "X-Booking-Pageview-Id": os.getenv("X_BOOKING_PAGEVIEW_ID"), - "X-Booking-Site-Type-Id": os.getenv("X_BOOKING_SITE_TYPE_ID"), - "X-Booking-Topic": os.getenv("X_BOOKING_TOPIC"), + "x-booking-context-action-name": os.getenv("X_BOOKING_CONTEXT_ACTION_NAME"), + "x-booking-context-aid": os.getenv("X_BOOKING_CONTEXT_AID"), + "x-booking-csrf-token": os.getenv("X_BOOKING_CSRF_TOKEN"), + "x-booking-et-serialized-state": os.getenv("X_BOOKING_ET_SERIALIZED_STATE"), + "x-booking-pageview-id": os.getenv("X_BOOKING_PAGEVIEW_ID"), + "x-booking-site-type-id": os.getenv("X_BOOKING_SITE_TYPE_ID"), + "x-booking-topic": os.getenv("X_BOOKING_TOPIC"), } return headers From 9bf72e287d692c394b6c8311030e66156cad85bc Mon Sep 17 00:00:00 2001 From: Sakan Nirattisaykul <94357278+sakan811@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:26:30 +0700 Subject: [PATCH 3/3] Update backend-test.yml --- .github/workflows/backend-test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/backend-test.yml b/.github/workflows/backend-test.yml index c098ac6..084597a 100644 --- a/.github/workflows/backend-test.yml +++ b/.github/workflows/backend-test.yml @@ -50,5 +50,13 @@ jobs: working-directory: ./backend env: USER_AGENT: ${{ secrets.USER_AGENT }} + X_BOOKING_CONTEXT_ACTION_NAME: ${{ secrets.X_BOOKING_CONTEXT_ACTION_NAME }} + X_BOOKING_CONTEXT_AID: ${{ secrets.X_BOOKING_CONTEXT_AID }} + X_BOOKING_CSRF_TOKEN: ${{ secrets.X_BOOKING_CSRF_TOKEN }} + X_BOOKING_ET_SERIALIZED_STATE: ${{ secrets.X_BOOKING_ET_SERIALIZED_STATE }} + X_BOOKING_PAGEVIEW_ID: ${{ secrets.X_BOOKING_PAGEVIEW_ID }} + X_BOOKING_SITE_TYPE_ID: ${{ secrets.X_BOOKING_SITE_TYPE_ID }} + X_BOOKING_TOPIC: ${{ secrets.X_BOOKING_TOPIC }} run: | pytest +