diff --git a/instaparser/client.py b/instaparser/client.py index 9d6dbcf..670234f 100644 --- a/instaparser/client.py +++ b/instaparser/client.py @@ -119,7 +119,6 @@ def __init__(self, api_key: str, base_url: str | None = None): self.base_url = base_url or self.BASE_URL self.headers = { "Authorization": f"Bearer {api_key}", - "Content-Type": "application/json", } def __repr__(self) -> str: @@ -157,14 +156,14 @@ def _request( url = f"{url}?{urlencode(params)}" data = None - headers = self.headers + headers = self.headers.copy() if multipart_fields or multipart_files: data, content_type = _encode_multipart_formdata(multipart_fields or {}, multipart_files or {}) - headers = headers.copy() headers["Content-Type"] = content_type elif json_data is not None: data = json.dumps(json_data).encode("utf-8") + headers["Content-Type"] = "application/json" req = Request(url, data=data, headers=headers, method=method) response: HTTPResponse = urlopen(req) diff --git a/tests/test_client.py b/tests/test_client.py index 6dd1307..e408e8f 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -119,7 +119,6 @@ def test_base_url(self): def test_headers(self): client = InstaparserClient(api_key=API_KEY) assert client.headers["Authorization"] == f"Bearer {API_KEY}" - assert client.headers["Content-Type"] == "application/json" class TestReadJson: