Skip to content

Commit

Permalink
Merge pull request #43 from sakan811/sakan811-patch-1
Browse files Browse the repository at this point in the history
Update graphql_func.py
  • Loading branch information
sakan811 authored Oct 15, 2024
2 parents 1a09fc9 + 9bf72e2 commit d0ead84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/backend-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 10 additions & 3 deletions backend/scraper/scraper_func/graphql_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down

0 comments on commit d0ead84

Please sign in to comment.