Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't do any action #21

Open
AlexPaiva opened this issue Aug 25, 2023 · 2 comments
Open

Can't do any action #21

AlexPaiva opened this issue Aug 25, 2023 · 2 comments

Comments

@AlexPaiva
Copy link

AlexPaiva commented Aug 25, 2023

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?

@AlexPaiva
Copy link
Author

AlexPaiva commented Aug 25, 2023

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.

@ranjeetsn
Copy link

ranjeetsn commented Mar 14, 2024

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants