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

errors #13

Closed
ahmedalrawi opened this issue Dec 12, 2021 · 2 comments · Fixed by #14
Closed

errors #13

ahmedalrawi opened this issue Dec 12, 2021 · 2 comments · Fixed by #14

Comments

@ahmedalrawi
Copy link

Hi, I am trying to get hashtags but the command isn't working. Is the script still working? I am getting errors such as the following one. The only command that is working for me is related to the users' info and pulling all posts (with another error copied below). Thanks again!

Traceback (most recent call last):
File "c:\users\ahmed\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\ahmed\anaconda3\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\Ahmed\anaconda3\Scripts\gogettr.exe_main
.py", line 7, in
File "c:\users\ahmed\anaconda3\lib\site-packages\click\core.py", line 1128, in call
return self.main(*args, **kwargs)
File "c:\users\ahmed\anaconda3\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "c:\users\ahmed\anaconda3\lib\site-packages\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\ahmed\anaconda3\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\ahmed\anaconda3\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "c:\users\ahmed\anaconda3\lib\site-packages\gogettr\cli.py", line 41, in user
for post in client.user_activity(username, max=max, until=until, type=type):
File "c:\users\ahmed\anaconda3\lib\site-packages\gogettr\capabilities\user_activity.py", line 38, in pull
for data in self.client.get_paginated(
File "c:\users\ahmed\anaconda3\lib\site-packages\gogettr\api.py", line 93, in get_paginated
data = self.get(*args, **kwargs)
File "c:\users\ahmed\anaconda3\lib\site-packages\gogettr\api.py", line 77, in get
raise GettrApiError(errors[-1]) # Throw with most recent error
gogettr.errors.GettrApiError

++++++++
Pull all posts error

File "c:\users\ahmed\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\ahmed\anaconda3\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\Ahmed\anaconda3\Scripts\gogettr.exe_main
.py", line 7, in
File "c:\users\ahmed\anaconda3\lib\site-packages\click\core.py", line 1128, in call
return self.main(*args, **kwargs)
File "c:\users\ahmed\anaconda3\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "c:\users\ahmed\anaconda3\lib\site-packages\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\ahmed\anaconda3\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\ahmed\anaconda3\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "c:\users\ahmed\anaconda3\lib\site-packages\gogettr\cli.py", line 82, in all
for post in client.all(
File "c:\users\ahmed\anaconda3\lib\site-packages\gogettr\capabilities\all.py", line 46, in pull
result = futures.popleft().result()
File "c:\users\ahmed\anaconda3\lib\concurrent\futures_base.py", line 432, in result
return self.__get_result()
File "c:\users\ahmed\anaconda3\lib\concurrent\futures_base.py", line 388, in __get_result
raise self._exception
File "c:\users\ahmed\anaconda3\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "c:\users\ahmed\anaconda3\lib\site-packages\gogettr\capabilities\all.py", line 108, in _pull_post
if data["data"]["txt"] == "Content Not Found":
KeyError: 'txt

@KonradIT
Copy link
Contributor

Seems a bunch of stuff has changed backend wise.

output of pytest
================================================= test session starts ==================================================
platform linux -- Python 3.8.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /mnt/c/Users/konra/GitHub/gogettr
collected 23 items

tests/test_all.py .FF.                                                                                           [ 17%]
tests/test_comments.py ...                                                                                       [ 30%]
tests/test_hashtags.py .                                                                                         [ 34%]
tests/test_registration_status.py ..                                                                             [ 43%]
tests/test_search.py ..                                                                                          [ 52%]
tests/test_suggested.py .                                                                                        [ 56%]
tests/test_trends.py .                                                                                           [ 60%]
tests/test_user_activity.py .....                                                                                [ 82%]
tests/test_user_info.py F.                                                                                       [ 91%]
tests/test_user_relationships.py ..                                                                              [100%]

======================================================= FAILURES =======================================================
_______________________________________________ test_user_posts_downward _______________________________________________

    def test_user_posts_downward():
        """Verifies that we can pull posts backward."""
>       posts = list(client.all(last="pew9", max=10, order="down"))

tests/test_all.py:16:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gogettr/capabilities/all.py:46: in pull
    result = futures.popleft().result()
/usr/lib/python3.8/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/usr/lib/python3.8/concurrent/futures/_base.py:388: in __get_result
    raise self._exception
/usr/lib/python3.8/concurrent/futures/thread.py:57: in run
    result = self.fn(*self.args, **self.kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <gogettr.capabilities.all.All object at 0x7f0b1251c4c0>, post_id = 'pew9'

    def _pull_post(self, post_id: str) -> dict:
        """Attempt to pull the given post from GETTR."""

        try:
            data = self.client.get(
                f"/u/post/{post_id}",
                params={
                    "incl": "poststats|userinfo|posts|commentstats",
                },
                key="result",
            )
        except GettrApiError as e:
            logging.warning("Hit API error while pulling: %s", e)
            return

>       if data["data"]["txt"] == "Content Not Found":
E       KeyError: 'txt'

gogettr/capabilities/all.py:108: KeyError
______________________________________________ test_user_posts_limited_id ______________________________________________

    def test_user_posts_limited_id():
        """Verifies that we can pull posts backward with an ID as the endpoint."""
>       posts = list(client.all(last="pew9", first="pew0", order="down"))

tests/test_all.py:22:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gogettr/capabilities/all.py:46: in pull
    result = futures.popleft().result()
/usr/lib/python3.8/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/usr/lib/python3.8/concurrent/futures/_base.py:388: in __get_result
    raise self._exception
/usr/lib/python3.8/concurrent/futures/thread.py:57: in run
    result = self.fn(*self.args, **self.kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <gogettr.capabilities.all.All object at 0x7f0b123ca250>, post_id = 'pew9'

    def _pull_post(self, post_id: str) -> dict:
        """Attempt to pull the given post from GETTR."""

        try:
            data = self.client.get(
                f"/u/post/{post_id}",
                params={
                    "incl": "poststats|userinfo|posts|commentstats",
                },
                key="result",
            )
        except GettrApiError as e:
            logging.warning("Hit API error while pulling: %s", e)
            return

>       if data["data"]["txt"] == "Content Not Found":
E       KeyError: 'txt'

gogettr/capabilities/all.py:108: KeyError
____________________________________________________ test_user_info ____________________________________________________

    def test_user_info():
        """Verifies we can extract user info for a simple, known user."""
        resp = client.user_info(username="support")
        print(resp)
        assert resp["nickname"] == "Support & Help"
        assert resp["username"] == "support"
        assert resp["ousername"] == "support"
>       assert resp["infl"] == 1
E       assert 2 == 1

tests/test_user_info.py:16: AssertionError
------------------------------------------------- Captured stdout call -------------------------------------------------
{'udate': '1625531847570', '_t': 'uinf', '_id': 'support', 'nickname': 'Support & Help', 'username': 'support', 'ousername': 'support', 'dsc': 'Account of GETTR support team', 'status': 'a', 'cdate': '1625132755820', 'lang': 'en', 'infl': 2, 'ico': 'group32/getter/2021/07/01/09/d9afb416-365a-4b26-d286-77e896dcb2b5/e0a628c3ce79d5178af9f033868f9153.jpg', 'bgimg': 'group25/getter/2021/07/02/12/acd80071-ece7-af19-03b6-c864f5a44268/c205b9f9e47b265756c4d07dd9ba8ffc.jpg', 'location': 'NYC, NY', 'flw': '0', 'flg': '1750180', 'aux': None}
=============================================== short test summary info ================================================
FAILED tests/test_all.py::test_user_posts_downward - KeyError: 'txt'
FAILED tests/test_all.py::test_user_posts_limited_id - KeyError: 'txt'
FAILED tests/test_user_info.py::test_user_info - assert 2 == 1
============================================ 3 failed, 20 passed in 36.37s =============================================

@KonradIT KonradIT mentioned this issue Dec 12, 2021
@milesmcc
Copy link
Collaborator

Thanks for the bug report. These should hopefully fixed once I merge #14 from @KonradIT. Thanks, Konrad.

@milesmcc milesmcc linked a pull request Dec 13, 2021 that will close this issue
@hack-r hack-r mentioned this issue Jan 1, 2022
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

Successfully merging a pull request may close this issue.

3 participants