davidteather / TikTok-Api

The Unofficial TikTok API Wrapper In Python
https://davidteather.github.io/TikTok-Api
MIT License
4.76k stars 960 forks source link

[BUG] - cannot import name 'TikTokApi' from 'TikTokApi' #1145

Closed dikalasenjadatang closed 5 months ago

dikalasenjadatang commented 5 months ago

Fill Out the template :)

Describe the bug

A clear and concise description of what the bug is.

The buggy code

Please add any relevant code that is giving you unexpected results.

Preferably the smallest amount of code to reproduce the issue.

SET LOGGING LEVEL TO INFO BEFORE POSTING CODE OUTPUT

import os
import asyncio
from TikTokApi import TikTokApi

video_id = 7248300636498890011
ms_token = os.environ.get("ms_token", None)  # set your own ms_token

async def get_comments():
    async with TikTokApi() as api:
        await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3)
        video = await api.get_video_by_id(video_id)
        count = 0
        async for comment in video.comments(count=30):
            print(comment)
            print(await comment.as_dict())

if __name__ == "__main__":
    asyncio.run(get_comments())

# Hopefully the info level will help you debug or at least someone else on the issue
# Code Goes Here

Expected behavior

A clear and concise description of what you expected to happen.

Error Trace (if any)

Put the error trace below if there's any error thrown.

# Error Trace Here

Desktop (please complete the following information):

Additional context

Add any other context about the problem here.

wtfterm commented 3 months ago

do you know how to fix this issue?