Skip to content

Commit

Permalink
Set User-Agent header in ProviderDataIngester
Browse files Browse the repository at this point in the history
  • Loading branch information
krysal committed Feb 26, 2024
1 parent b7ab1f8 commit db8fe6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion catalog/dags/common/requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DelayedRequester:
delay: an integer giving the minimum number of seconds to wait
between consecutive requests via the `get` method.
headers: a dict that will be passed in all requests, unless overridden
by kwargs in specific calls to the get method
by kwargs in specific calls to the `get` method
"""

def __init__(self, delay: int = 0, headers: dict | None = None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from airflow.exceptions import AirflowException
from airflow.models import Variable

from common.loader import provider_details as prov
from common.requester import DelayedRequester
from common.storage.media import MediaStore
from common.storage.util import get_media_store_class
Expand Down Expand Up @@ -145,6 +146,9 @@ def __init__(
# Keep track of number of records ingested
self.record_count = 0

# Set default headers
self.headers = {"User-Agent": prov.UA_STRING} | self.headers

# Initialize the DelayedRequester and all necessary Media Stores.
self.delayed_requester = DelayedRequester(
delay=self.delay, headers=self.headers
Expand Down

0 comments on commit db8fe6b

Please sign in to comment.