Russell-Newton / TikTokPy

Extract data from TikTok without needing any login information or API keys.
https://pypi.org/project/tiktokapipy/
MIT License
197 stars 25 forks source link

Exception trying to use an API instance #15

Closed henrieger closed 1 year ago

henrieger commented 1 year ago

Hello, it seems that any use of an API instance always gets me the following exception:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/playwright/_impl/_page.py", line 255, in _on_route
    handled = await route_handler.handle(route)
  File "/home/user/.local/lib/python3.8/site-packages/playwright/_impl/_helper.py", line 290, in handle
    g.switch()
  File "/home/user/.local/lib/python3.8/site-packages/playwright/_impl/_helper.py", line 280, in impl
    result = cast(
  File "/home/user/.local/lib/python3.8/site-packages/playwright/_impl/_impl_to_api_mapping.py", line 123, in wrapper_func
    return handler(
  File "/home/user/.local/lib/python3.8/site-packages/tiktokapipy/api.py", line 292, in capture_api_extras
    response = route.fetch()
AttributeError: 'Route' object has no attribute 'fetch'

It wasn't causing me any trouble before as it doesn't stop execution of the code, but as I started using the multiprocessing library, the processes just die when this exception appears. But even when I was not using multiple processes, it was still very annoying and made it very difficult to debug my code. A try-except block around the API call doesn't seem to solve the issue.

Russell-Newton commented 1 year ago

This is due to an update I had made and I forgot to update the Playwright requirement. You need to have playwright~=1.29. I've updated pyproject.toml in v0.1.8.post1 to address this.

Please let me know if that fixes your issue.

henrieger commented 1 year ago

That fixed it. Thank you for your help :)