Skip to content

Commit 2ec9a6b

Browse files
authored
Fix Tumblr fetch when text_only=False (#80)
Calling `fetch_social_posting_vertical(text_only=False)` returns a 404 from Tumblr's API because the code was sending `type=` (empty string) as a query parameter. When `text_only=False`, omit the `type` parameter entirely. Tumblr accepts no `type` to mean "all types" but rejects `type=`. Closes #81 Update: This PR also closes #82
1 parent e1cb2f7 commit 2ec9a6b

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "pardner"
77
version = "0.0.1"
88
description = "Python library for authorizing access and fetching personal data from portability APIs and services"
99
readme = "README.md"
10-
requires-python = ">=3.11"
10+
requires-python = ">=3.11,<3.14"
1111
classifiers = [
1212
"Programming Language :: Python :: 3",
1313
"Operating System :: OS Independent",

src/pardner/services/tumblr.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,12 @@ def fetch_social_posting_vertical(
121121
made.
122122
"""
123123
if count <= 20:
124+
params: dict[str, Any] = {'limit': count, 'npf': True, **request_params}
125+
if text_only:
126+
params['type'] = 'text'
124127
dashboard_response = self._get_resource_from_path(
125128
'user/dashboard',
126-
{
127-
'limit': count,
128-
'npf': True,
129-
'type': 'text' if text_only else '',
130-
**request_params,
131-
},
129+
params,
132130
)
133131
return list(dashboard_response.json().get('response').get('posts'))
134132
raise UnsupportedRequestException(

0 commit comments

Comments
 (0)