diff --git a/instagrapi/__init__.py b/instagrapi/__init__.py index 7b0dae7d..02328ac3 100644 --- a/instagrapi/__init__.py +++ b/instagrapi/__init__.py @@ -95,6 +95,7 @@ def __init__( settings: dict = {}, proxy: str = None, delay_range: list = None, + user_headers: dict = {}, logger=DEFAULT_LOGGER, **kwargs, ): @@ -104,6 +105,7 @@ def __init__( self.settings = settings self.logger = logger self.delay_range = delay_range + self.user_headers = user_headers self.set_proxy(proxy) diff --git a/instagrapi/mixins/auth.py b/instagrapi/mixins/auth.py index 4326a2d6..6ad59049 100644 --- a/instagrapi/mixins/auth.py +++ b/instagrapi/mixins/auth.py @@ -335,7 +335,7 @@ def init(self) -> bool: self.set_ig_u_rur(self.settings.get("ig_u_rur")) self.set_ig_www_claim(self.settings.get("ig_www_claim")) # init headers - headers = self.base_headers + headers = self.user_headers or self.base_headers headers.update({"Authorization": self.authorization}) self.private.headers.update(headers) return True