Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions instaparser/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def article(self, url: str, content: str | None = None, output: str = "html", us
"output": output,
}
if not use_cache:
payload["use_cache"] = "false"
payload["use_cache"] = False
if content is not None:
payload["content"] = content

Expand Down Expand Up @@ -274,7 +274,7 @@ def summary(
"stream": stream_callback is not None,
}
if not use_cache:
payload["use_cache"] = "false"
payload["use_cache"] = False
if content is not None:
payload["content"] = content

Expand Down Expand Up @@ -337,7 +337,7 @@ def pdf(
raise InstaparserValidationError("output must be 'html', 'text', or 'markdown'")

if file is not None:
fields = {"output": output}
fields: dict[str, Any] = {"output": output}
if not use_cache:
fields["use_cache"] = "false"
if url:
Expand All @@ -353,7 +353,7 @@ def pdf(
except HTTPError as e:
_map_http_error(e)
elif url:
params = {
params: dict[str, Any] = {
"url": url,
"output": output,
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def test_with_content(self, client, mock_request):
def test_use_cache_false(self, client, mock_request):
mock_request.return_value = make_response(json_data=ARTICLE_DATA)
client.article(url="u", use_cache=False)
assert mock_request.call_args[1]["json_data"]["use_cache"] == "false"
assert mock_request.call_args[1]["json_data"]["use_cache"] is False

def test_invalid_output(self, client):
with pytest.raises(InstaparserValidationError, match="output must be"):
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_with_content(self, client, mock_request):
def test_use_cache_false(self, client, mock_request):
mock_request.return_value = make_response(json_data=SUMMARY_DATA)
client.summary(url="u", use_cache=False)
assert mock_request.call_args[1]["json_data"]["use_cache"] == "false"
assert mock_request.call_args[1]["json_data"]["use_cache"] is False

def test_empty_response(self, client, mock_request):
mock_request.return_value = make_response(json_data={})
Expand Down