Skip to content

Commit 0f3d51a

Browse files
digithreeclaude
andcommitted
Fix Pocket API calls - use POST instead of GET and remove deprecated stats endpoint
- Change requests.get() to requests.post() for /v3/get endpoint - Remove fetch_stats() function as /v3/stats endpoint no longer exists - Update CLI to show progress bar without total count from stats - API now properly returns JSON instead of 403 CloudFront errors Fixes fundamental API connectivity issues preventing data fetching. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1d2170e commit 0f3d51a

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

pocket_to_sqlite/cli.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,15 @@ def fetch(db_path, auth, all, silent):
9595
{"id": 1, "since": since}, replace=True, pk="id"
9696
),
9797
)
98-
if (all or last_since is None) and not silent:
99-
total_items = utils.fetch_stats(auth)["count_list"]
100-
with click.progressbar(fetch, length=total_items, show_pos=True) as bar:
98+
if not silent:
99+
# Show progress bar without total count since stats endpoint is removed
100+
with click.progressbar(fetch, show_pos=True) as bar:
101101
utils.save_items(bar, db)
102102
else:
103103
# No progress bar
104-
print("Fetching items since {}".format(last_since))
104+
if last_since:
105+
print("Fetching items since {}".format(last_since))
106+
else:
107+
print("Fetching all items")
105108
utils.save_items(fetch, db)
106109
utils.ensure_fts(db)

pocket_to_sqlite/utils.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,6 @@ def ensure_fts(db):
6868
db["items"].enable_fts(["resolved_title", "excerpt"], create_triggers=True)
6969

7070

71-
def fetch_stats(auth):
72-
response = requests.get(
73-
"https://getpocket.com/v3/stats",
74-
{
75-
"consumer_key": auth["pocket_consumer_key"],
76-
"access_token": auth["pocket_access_token"],
77-
},
78-
)
79-
response.raise_for_status()
80-
return response.json()
8171

8272

8373
class FetchItems:
@@ -106,7 +96,7 @@ def __iter__(self):
10696
}
10797
if self.since is not None:
10898
args["since"] = self.since
109-
response = requests.get("https://getpocket.com/v3/get", args)
99+
response = requests.post("https://getpocket.com/v3/get", args)
110100
if response.status_code == 503 and retries < 5:
111101
print("Got a 503, retrying...")
112102
retries += 1

0 commit comments

Comments
 (0)