From 8a9200e62785718235823ca99aaf8eb2c9e3fd83 Mon Sep 17 00:00:00 2001 From: agatha Date: Fri, 10 Nov 2023 19:42:16 -0500 Subject: [PATCH] Add header support --- gitmon/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitmon/api.py b/gitmon/api.py index 1a9e7dd..f9abda8 100644 --- a/gitmon/api.py +++ b/gitmon/api.py @@ -6,13 +6,15 @@ from requests.packages.urllib3.util.retry import Retry class GitHubApi: - def __init__(self, proxy=None): + def __init__(self, headers=None, proxy=None): self.base_url = 'https://api.github.com' self.session = requests.Session() retries = Retry(total=3, backoff_factor=1) self.session.mount('https://', HTTPAdapter(max_retries=retries)) + if headers: + self.session.headers.update(headers) if proxy: self.session.proxies.update(proxy)