avilash / TikTokAPI-Python

TikTok API Python Wrapper
http://avilashkumar.com/TikTokAPI-Python/
MIT License
450 stars 113 forks source link

Getting started #4

Closed alejandrofrank closed 4 years ago

alejandrofrank commented 4 years ago

Hello,

I can't start using the API, when I use examples from the readme I encounter some errors.

api = TikTokAPI()
user_obj = api.getUserByName("fcbarcelona")

This is the error `--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last)

in 1 api = TikTokAPI() ----> 2 user_obj = api.getUserByName("pompeiibrand") c:\users\aleja\appdata\local\programs\python\python37\lib\site-packages\pytiktokapi-0.0.3-py3.7.egg\TikTokAPI\tiktokapi.py in getUserByName(self, user_name) 70 for key, val in self.default_params.items(): 71 params[key] = val ---> 72 return self.send_get_request(url, params) 73 74 def getVideosByUserName(self, user_name, count=30): c:\users\aleja\appdata\local\programs\python\python37\lib\site-packages\pytiktokapi-0.0.3-py3.7.egg\TikTokAPI\tiktokapi.py in send_get_request(self, url, params, extra_headers) 29 def send_get_request(self, url, params, extra_headers=None): 30 url = build_get_url(url, params) ---> 31 signature = self.tiktok_browser.fetch_auth_params(url, language=self.language) 32 url = build_get_url(url, {self.signature_key: signature}, append=True) 33 if extra_headers is None: c:\users\aleja\appdata\local\programs\python\python37\lib\site-packages\pytiktokapi-0.0.3-py3.7.egg\TikTokAPI\tiktok_browser.py in fetch_auth_params(self, url, language) 53 54 def fetch_auth_params(self, url, language='en'): ---> 55 return asyncio.get_event_loop().run_until_complete(self.async_fetch_auth_params(url, language)) 56 57 async def async_fetch_auth_params(self, url, language): c:\users\aleja\appdata\local\programs\python\python37\lib\asyncio\base_events.py in run_until_complete(self, future) 561 """ 562 self._check_closed() --> 563 self._check_runnung() 564 565 new_task = not futures.isfuture(future) c:\users\aleja\appdata\local\programs\python\python37\lib\asyncio\base_events.py in _check_runnung(self) 521 def _check_runnung(self): 522 if self.is_running(): --> 523 raise RuntimeError('This event loop is already running') 524 if events._get_running_loop() is not None: 525 raise RuntimeError( RuntimeError: This event loop is already running` Do you know how to fix it? Kind regards
pranavsekhar commented 4 years ago

I'm getting the same error - were you able to resolve it?