I am trying to use with Django, it was working last week, but now it is showing an error with Exception: Invalid Response.
I upgrade the API too. via pip install TikTokApi --upgrade. but still showing exception.
Here's the code
API = TikTokApi()
results = API.trending(count=VIDEOS_COUNT)
Error Trace
{'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36', 'accept-encoding': 'gzip, deflate, br', 'accept': 'application/json, text/plain, */*', 'Connection': 'keep-alive', 'authority': 'm.tiktok.com', 'method': 'GET', 'path': '/api/item_list/?aid=1988&app_name=tiktok_web&device_platform=web&referer=https%3A%2F%2Fwww.', 'scheme': 'https', 'accept-language': 'en-US,en;q=0.9', 'referer': 'https://www.tiktok.com/', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-site', 'cookie': 'tt_webid_v2=746436216'}
Converting response to JSON failed response is below (probably empty)
illegal request...
Internal Server Error
Traceback (most recent call last):
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/TikTokApi/tiktok.py", line 103, in getData
return r.json()
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/requests/models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/TikTokApi/tiktok.py", line 190, in trending
res = self.getData(b, **kwargs)
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/TikTokApi/tiktok.py", line 113, in getData
raise Exception("Invalid Response")
Exception: Invalid Response
ERROR 2020-12-03 00:01:27,081 log 16905 140297062823680 Internal Server Error: /dashboard/
Traceback (most recent call last):
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/TikTokApi/tiktok.py", line 103, in getData
return r.json()
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/requests/models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.6/contextlib.py", line 52, in inner
return func(*args, **kwds)
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/django/views/generic/edit.py", line 142, in post
return self.form_valid(form)
File "/home/{user}/{DjangoApp}/{DjangoApp}/dashboard/views.py", line 25, in form_valid
'hashtag': hashtag,
File "/home/{user}/{DjangoApp}/{DjangoApp}/utils/tiktok.py", line 86, in generate_video
results = API.trending(count=VIDEOS_COUNT)
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/TikTokApi/tiktok.py", line 190, in trending
res = self.getData(b, **kwargs)
File "/home/{user}/Documents/venv/lib/python3.6/site-packages/TikTokApi/tiktok.py", line 113, in getData
raise Exception("Invalid Response")
Exception: Invalid Response
Desktop (please complete the following information):
I am trying to use with Django, it was working last week, but now it is showing an error with
Exception: Invalid Response
. I upgrade the API too. viapip install TikTokApi --upgrade
. but still showing exception.Here's the code
Error Trace
Desktop (please complete the following information):
Additional context