Closed Hawaii-Yan closed 8 months ago
The library is for sure in an experimental state, but the code sample from the read me was out of date, so I just updated it. Currently the two example scripts that should be working are the user_example.py
and comment_example.py
scripts. Together those two scripts allow you to get all the videos from a user's page, and get the comments from those videos.
Sorry, the example you provided is still not working.😭😭😭
What's the error you're getting?
The underlying issue here is that PyTok does not implement a synchronous __enter__, yet the examples do not function within an asynchronous context. I tried calling __aenter__ from a dummy __enter__ but it looks like everything needs to be asynchronous. I'm not good enough at python to know how to purely function in an async environment (can main be asynchronous? I don't think so) but I believe that's the root cause here.
Will do some more reading on asynchronous context managers (I'm trying to use get_videos.py) and hopefully come up with a PR, however for the python expert this is a 5 minute fix.
See here for running main async!: https://github.com/networkdynamics/pytok/blob/b7bf31f9fb3901e2ff0427de568e4f8c29481a5f/examples/video_example.py#L32
Thank you for providing the PyTok library.
However,while using the provided sample code, I encountered errors such as: 【TypeError: 'PyTok' object does not support the context manager protocol】; 【NotImplementedError:Output is truncated. View as a [scrollable element]or open in a [text editor]. Adjust cell output [settings]】
I have checked my environment and dependencies, but I am still unable to resolve this issue. Is there any additional configuration required, or is the PyTok library currently under maintenance?
Your assistance and guidance would be greatly appreciated.