WillReynolds5 / AutoGPT-Social

Autonomous Instagram bot which creates and optimizes posts to maximize engagement
MIT License
296 stars 51 forks source link

NoneType Error on each call to get_post_metrics(...) #8

Open blaine-costello opened 1 year ago

blaine-costello commented 1 year ago

get_post_metrics function call within update_metrics seems to be returning this error message. Runtime continues, but would be nice to clean this up if possible by catching the right exceptions in get_post_metrics(), or more specifically, in lines 6 or 7 I suspect, something is happening in the client that is related to the type of each input?

int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
Traceback (most recent call last):
  File "/Users/blaine/Code/AutoGPT-Social/venv/lib/python3.11/site-packages/instagrapi/mixins/user.py", line 189, in user_info_by_username
    user = self.user_info_by_username_gql(username)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/blaine/Code/AutoGPT-Social/venv/lib/python3.11/site-packages/instagrapi/mixins/user.py", line 142, in user_info_by_username_gql
    return extract_user_gql(self.public_a1_request(f"/{username!s}/")["user"])
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/blaine/Code/AutoGPT-Social/venv/lib/python3.11/site-packages/instagrapi/mixins/public.py", line 173, in public_a1_request
    response = self.public_request(
               ^^^^^^^^^^^^^^^^^^^^
  File "/Users/blaine/Code/AutoGPT-Social/venv/lib/python3.11/site-packages/instagrapi/mixins/public.py", line 72, in public_request
    return self._send_public_request(url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/blaine/Code/AutoGPT-Social/venv/lib/python3.11/site-packages/instagrapi/mixins/public.py", line 106, in _send_public_request
    expected_length = int(response.headers.get("Content-Length"))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'