diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 76b4b5d..4735108 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -50,7 +50,7 @@ jobs: pip install -r test-requirements.txt -r requirements.txt - name: Run tests run: | - mypy --check tinify + mypy tinify Integration_tests: if: github.event_name == 'push' diff --git a/tinify/client.py b/tinify/client.py index a170b05..ae27548 100644 --- a/tinify/client.py +++ b/tinify/client.py @@ -5,6 +5,7 @@ import os import platform import requests +from requests.structures import CaseInsensitiveDict import requests.exceptions from requests.compat import json # type: ignore import traceback @@ -31,9 +32,9 @@ def __init__(self, key, app_identifier=None, proxy=None): # type: (str, Optiona if proxy: self.session.proxies = {'https': proxy} self.session.auth = ('api', key) - self.session.headers = { + self.session.headers = CaseInsensitiveDict({ 'user-agent': self.USER_AGENT + ' ' + app_identifier if app_identifier else self.USER_AGENT, - } + }) self.session.verify = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data', 'cacert.pem') def __enter__(self): # type: () -> Client