Comment by grejty on 20/05/2023 at 12:20 UTC

11 upvotes, 1 direct replies (showing 1)

View submission: API has been taken down

Is there a way to catch this "error" via PMAW? I would like to catch it and add it to my .log file as a proof for my Bachelor that pushshift is done :D

Replies

Comment by gurnec at 20/05/2023 at 13:38 UTC

9 upvotes, 1 direct replies

This should do it:

from pmaw import PushshiftAPI
from json.decoder import JSONDecodeError

api = PushshiftAPI()
try:
    s = api.search_submissions()
except JSONDecodeError as exc:
    print(exc.doc)

I hope you got what you needed before today!