ChrisStevens / garc

Python library and command line tool for collecting JSON data from Gab.ai. Scrape posts, users and comments from "free-speech" social media platform Gab.
MIT License
35 stars 15 forks source link

Error encountered "NoneType' object has no attribute json #15

Open zackees opened 2 years ago

zackees commented 2 years ago

I got this log dump from a client. This error can be handled from the calling code, but I wanted to share this stack trace in the hopes it can be cleared up on the garc end.

WARNING:root:Connection Error from Gab API! trying again
Error encountered: 'NoneType' object has no attribute 'json'
StackTrace:
Traceback (most recent call last):
  File "/var/folders/6v/m_qbtb2d72dcq0652npbx_sw0000gn/T//onefile_9629_1652963001_78033/rss2gab/rss2gab.py", line 117, in rss2gab_loop
  File "/var/folders/6v/m_qbtb2d72dcq0652npbx_sw0000gn/T//onefile_9629_1652963001_78033/rss2gab/rss2gab.py", line 69, in rss2gab
  File "/var/folders/6v/m_qbtb2d72dcq0652npbx_sw0000gn/T//onefile_9629_1652963001_78033/rss2gab/gab_readposts.py", line 28, in gab_readposts
  File "/var/folders/6v/m_qbtb2d72dcq0652npbx_sw0000gn/T//onefile_9629_1652963001_78033/garc/client.py", line 173, in userposts
AttributeError: 'NoneType' object has no attribute 'json'

Best guess at what's happening

I believe that this line: account_id = self.get(account_url).json()['id']

Is returning a None value when gab happens to be down, therefore None.json() throws this exception.