yazdipour / OmnivoreX

Omnivore TUI Terminal Client [Windows - MacOS - Linux]
https://pypi.org/project/omnivorex/
MIT License
48 stars 2 forks source link

TransportQueryError after clicking "Load More" #5

Open mgaitan opened 1 month ago

mgaitan commented 1 month ago

After starting the app and clicking "Load more" button, the app crashed with this traceback.

╭──────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────────────────╮
│ /home/tin/.local/share/uv/tools/omnivorex/lib/python3.12/site-packages/omnivorex/omnivorex.py:99 in on_button_pressed                                                                      │
│                                                                                                                                                                                            │
│    96 │                                                                                        ╭─────────────────────────── locals ───────────────────────────╮                            │
│    97 │   def on_button_pressed(self, event: Button.Pressed) -> None:                          │ event = Pressed()                                            │                            │
│    98 │   │   if event.button.id == "load_more":                                               │  self = OmnivoreX(title='OmnivoreX', classes={'-dark-mode'}) │                            │
│ ❱  99 │   │   │   self.load_more()                                                             ╰──────────────────────────────────────────────────────────────╯                            │
│   100 │                                                                                                                                                                                    │
│   101 │   def action_settings(self) -> None:                                                                                                                                               │
│   102 │   │   def set_api_token(token: str) -> None:                                                                                                                                       │
│                                                                                                                                                                                            │
│ /home/tin/.local/share/uv/tools/omnivorex/lib/python3.12/site-packages/omnivorex/omnivorex.py:163 in load_more                                                                             │
│                                                                                                                                                                                            │
│   160 │   def load_more(self):                                                                 ╭─────────────────────────── locals ────────────────────────────╮                           │
│   161 │   │   lv = self.query_one("#list_view", ListView)                                      │ cursor = '42'                                                 │                           │
│   162 │   │   cursor = 0 if len(lv.children) == 0 else lv.children[-1].details["cursor"]       │     lv = ListView(id='list_view')                             │                           │
│ ❱ 163 │   │   self.populate_listview(utils.get_articles(cursor, self.DEFAULT_LIMIT))           │   self = OmnivoreX(title='OmnivoreX', classes={'-dark-mode'}) │                           │
│   164                                                                                          ╰───────────────────────────────────────────────────────────────╯                           │
│   165                                                                                                                                                                                      │
│   166 def main():                                                                                                                                                                          │
│                                                                                                                                                                                            │
│ /home/tin/.local/share/uv/tools/omnivorex/lib/python3.12/site-packages/omnivorex/utils.py:44 in get_articles                                                                               │
│                                                                                                                                                                                            │
│   41                                                                                          ╭────── locals ───────╮                                                                      │
│   42                                                                                          │ cursor = 42         │                                                                      │
│   43 def get_articles(limit: int, cursor: int = 0, query="in:inbox"):                         │  limit = '42'       │                                                                      │
│ ❱ 44 │   return get_client().get_articles(cursor=str(cursor), limit=limit, query=query)[      │  query = 'in:inbox' │                                                                      │
│   45 │   │   "search"                                                                         ╰─────────────────────╯                                                                      │
│   46 │   ]["edges"]                                                                                                                                                                        │
│   47                                                                                                                                                                                       │
│                                                                                                                                                                                            │
│ /home/tin/.local/share/uv/tools/omnivorex/lib/python3.12/site-packages/omnivoreql/omnivoreql.py:121 in get_articles                                                                        │
│                                                                                                                                                                                            │
│   118 │   │   :param query: The query to use for filtering articles. Example of query by date: ╭─────────────────────────────────── locals ────────────────────────────────────╮           │
│   119 │   │   :param include_content: Whether to include the content of the articles.          │          cursor = '42'                                                        │           │
│   120 │   │   """                                                                              │          format = 'html'                                                      │           │
│ ❱ 121 │   │   return self.client.execute(                                                      │ include_content = False                                                       │           │
│   122 │   │   │   self._get_query("Search"),                                                   │           limit = '42'                                                        │           │
│   123 │   │   │   variable_values={                                                            │           query = 'in:inbox'                                                  │           │
│   124 │   │   │   │   "first": limit,                                                          │            self = <omnivoreql.omnivoreql.OmnivoreQL object at 0x7338235e27b0> │           │
│                                                                                                ╰───────────────────────────────────────────────────────────────────────────────╯           │
│                                                                                                                                                                                            │
│ /home/tin/.local/share/uv/tools/omnivorex/lib/python3.12/site-packages/gql/client.py:484 in execute                                                                                        │
│                                                                                                                                                                                            │
│    481 │   │   │   return data                                                                                                                                                             │
│    482 │   │                                                                                                                                                                               │
│    483 │   │   else:  # Sync transports                                                                                                                                                    │
│ ❱  484 │   │   │   return self.execute_sync(                                                                                                                                               │
│    485 │   │   │   │   document,                                                                                                                                                           │
│    486 │   │   │   │   variable_values=variable_values,                                                                                                                                    │
│    487 │   │   │   │   operation_name=operation_name,                                                                                                                                      │
│                                                                                                                                                                                            │
│ ╭─────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────╮                                                                  │
│ │             document = DocumentNode at 0:1761                                                                         │                                                                  │
│ │ get_execution_result = False                                                                                          │                                                                  │
│ │               kwargs = {}                                                                                             │                                                                  │
│ │       operation_name = None                                                                                           │                                                                  │
│ │         parse_result = None                                                                                           │                                                                  │
│ │                 self = <gql.client.Client object at 0x7338238e45f0>                                                   │                                                                  │
│ │  serialize_variables = None                                                                                           │                                                                  │
│ │      variable_values = {'first': '42', 'after': '42', 'query': 'in:inbox', 'format': 'html', 'includeContent': False} │                                                                  │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                  │
│                                                                                                                                                                                            │
│ /home/tin/.local/share/uv/tools/omnivorex/lib/python3.12/site-packages/gql/client.py:248 in execute_sync                                                                                   │
│                                                                                                                                                                                            │
│    245 │   ) -> Union[Dict[str, Any], ExecutionResult]:                                                                                                                                    │
│    246 │   │   """:meta private:"""                                                                                                                                                        │
│    247 │   │   with self as session:                                                                                                                                                       │
│ ❱  248 │   │   │   return session.execute(                                                                                                                                                 │
│    249 │   │   │   │   document,                                                                                                                                                           │
│    250 │   │   │   │   variable_values=variable_values,                                                                                                                                    │
│    251 │   │   │   │   operation_name=operation_name,                                                                                                                                      │
│                                                                                                                                                                                            │
│ ╭─────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────╮                                                                  │
│ │             document = DocumentNode at 0:1761                                                                         │                                                                  │
│ │ get_execution_result = False                                                                                          │                                                                  │
│ │               kwargs = {}                                                                                             │                                                                  │
│ │       operation_name = None                                                                                           │                                                                  │
│ │         parse_result = None                                                                                           │                                                                  │
│ │                 self = <gql.client.Client object at 0x7338238e45f0>                                                   │                                                                  │
│ │  serialize_variables = None                                                                                           │                                                                  │
│ │              session = <gql.client.SyncClientSession object at 0x733823656c00>                                        │                                                                  │
│ │      variable_values = {'first': '42', 'after': '42', 'query': 'in:inbox', 'format': 'html', 'includeContent': False} │                                                                  │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                  │
│                                                                                                                                                                                            │
│ /home/tin/.local/share/uv/tools/omnivorex/lib/python3.12/site-packages/gql/client.py:1028 in execute                                                                                       │
│                                                                                                                                                                                            │
│   1025 │   │                                                                                                                                                                               │
│   1026 │   │   # Raise an error if an error is returned in the ExecutionResult object                                                                                                      │
│   1027 │   │   if result.errors:                                                                                                                                                           │
│ ❱ 1028 │   │   │   raise TransportQueryError(                                                                                                                                              │
│   1029 │   │   │   │   str_first_element(result.errors),                                                                                                                                   │
│   1030 │   │   │   │   errors=result.errors,                                                                                                                                               │
│   1031 │   │   │   │   data=result.data,                                                                                                                                                   │
│                                                                                                                                                                                            │
│ ╭─────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────╮                                                                  │
│ │             document = DocumentNode at 0:1761                                                                         │                                                                  │
│ │ get_execution_result = False                                                                                          │                                                                  │
│ │               kwargs = {}                                                                                             │                                                                  │
│ │       operation_name = None                                                                                           │                                                                  │
│ │         parse_result = None                                                                                           │                                                                  │
│ │               result = ExecutionResult(data=None, errors=[{'message': 'Unexpected server error'}])                    │                                                                  │
│ │                 self = <gql.client.SyncClientSession object at 0x733823656c00>                                        │                                                                  │
│ │  serialize_variables = None                                                                                           │                                                                  │
│ │      variable_values = {'first': '42', 'after': '42', 'query': 'in:inbox', 'format': 'html', 'includeContent': False} │                                                                  │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TransportQueryError: {'message': 'Unexpected server error'}
yazdipour commented 1 month ago

Thanks for the bug reports. Its been a long time I did not touch omnivorex. It needs more love. I will work on as soon as I found some free time.

mgaitan commented 1 month ago

looks pretty cool and useful btw