stanfordio/truthbrush

Can't do any action

AlexPaiva opened this issue · 2 comments

Using the below code:

import truthbrush as tb

usi= "----"
passi= "----"
postIDI = "110948615193551722"
api = tb.Api(username=str(usi), password=str(passi), proxy_list=None)
api.get_posti(postIDI)

Where the get_posti is a custom function I added:

def get_posti(self, post_id: int = 50) -> dict:
        """Return a list of users who liked a post."""
        self.__check_login()
        params = {
            "limit": 10000000,
            "max_id": None
        }
        return self._get_paginated(f"/v1/statuses/{post_id}/favourited_by")

And I am getting this error:

2023-08-25 14:51:43.510 | ERROR    | truthbrush.api:get_auth_id:336 - Failed login request: HTTP Error 400:
2023-08-25 14:52:00.744 | ERROR    | truthbrush.api:get_auth_id:336 - Failed login request: HTTP Error 400:
2023-08-25 14:52:15.474 | ERROR    | truthbrush.api:get_auth_id:336 - Failed login request: HTTP Error 400:
2023-08-25 14:52:27.966 | ERROR    | truthbrush.api:get_auth_id:336 - Failed login request: HTTP Error 400:
2023-08-25 14:52:38.584 | ERROR    | truthbrush.api:get_auth_id:336 - Failed login request: HTTP Error 400:
2023-08-25 14:52:48.747 | ERROR    | truthbrush.api:get_auth_id:336 - Failed login request: HTTP Error 400:
2023-08-25 14:53:00.597 | ERROR    | truthbrush.api:get_auth_id:336 - Failed login request: HTTP Error 400:

(Line 336 contains: logger.error(f"Failed login request: {str(e)}") I have not modified this function or any other base function)

The account is fine as I could manually log in, tried with and without proxies, exact same error. What could be wrong?

Also got:

2023-08-25 15:02:18.252 | ERROR    | truthbrush.api:get_auth_id:327 - Failed login request: HTTP Error 400:
Traceback (most recent call last):
  File "C:\Users\AA\Downloads\tt.py", line 21, in <module>
    api.lookup(str(usi))
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\site-packages\truthbrush\api.py", line 131, in lookup
    return self._get("/v1/accounts/lookup", params=dict(acct=user_handle))
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\site-packages\truthbrush\api.py", line 86, in _get
    "Authorization": "Bearer " + self.auth_id,
TypeError: can only concatenate str (not "NoneType") to str

Line 327 contains: logger.error(f"Failed login request: {str(e)}") (function untouched)

Line 131 contains: return self._get("/v1/accounts/lookup", params=dict(acct=user_handle)) (overall lookup and other basic functions are untouched)

Line 86 contains: "Authorization": "Bearer " + self.auth_id, from the _get function which is untouched aswell.

@AlexPaiva Were you able to resolve this issue? I too would like a method to write a post to Turthsocial. Can you confirm if it is an issue in code or an issue with the permissions?