python-tiktok
A simple Python wrapper around for Tiktok API :sparkles: :cake: :sparkles:.
.. image:: https://img.shields.io/badge/TikTok-%23000000.svg?style=for-the-badge&logo=TikTok&logoColor=white
:target: https://developers.tiktok.com/
:alt: tiktok
.. image:: https://img.shields.io/pypi/v/python-tiktok.svg
:target: https://pypi.org/project/python-tiktok/
:alt: PyPI
============
Introduction
============
This library provides a service to easily use TikTok official apis.
For now, include follows apis:
- `TikTok for developers <https://developers.tiktok.com/>`_
- `TikTok for Business Account <https://ads.tiktok.com/marketing_api/docs?id=1732701966223426>`_
==========
Installing
==========
You can install this library easily by `pypi`:
.. code-block:: shell
$ pip install python-tiktok
More installing detail see `Installation docs <https://sns-sdks.lkhardy.cn/python-tiktok/installation/>`_
=====
Using
=====
You can see more usage detail at `usage docs <https://sns-sdks.lkhardy.cn/python-tiktok/usage/preparation/>`_
----------------
Business Account
----------------
Version Tips :
API for Business Version ``1.3`` is now live! visit `here <https://ads.tiktok.com/marketing_api/docs?id=1740579480076290>`_ for more details.
Now this library set default version to ``v1.3``.
And ``v1.2`` will be deprecated on August 15, 2023.
If you have account access token, you can initialize api instance by it.
.. code-block:: python
>>> from pytiktok import BusinessAccountApi
>>> business_api = BusinessAccountApi(access_token="Your Access Token")
Or you can let account to give permission by `OAuth flow`. See `business authorization docs <https://sns-sdks.lkhardy.cn/python-tiktok/authorization/business-authorization/>`_
Now you can get account's data.
Get account profile:
.. code-block:: python
>>> business_api.get_account_data(business_id="Business ID", return_json=True)
>>> # {'code':0,'message':'OK','request_id':'2022070106561301000400402500400500600301500A52386','data':{'display_name':'kiki','profile_image':'https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/accb4aeac4ec812e2bdc45ce1da1ed39~c5_168x168.jpeg?x-expires=1656828000&x-signature=MmXPWeImP%2BRGBwAOqN3wjPpDiZE%3D'}}
If you set function parameter `return_json` to `True`, will return the json dict data. Otherwise will return a `dataclass` object representing the response.
Get account videos:
.. code-block:: python
>>> business_api.get_account_videos(business_id="Business ID", return_json=True)
>>> # {'code':0,'message':'OK','request_id':'20220701071724010004003007735002053068B3FD9','data':{'videos':[{'item_id':'7108684822863760646'},{'item_id':'7109064881462152453'}],'has_more':False,'cursor':0}}
-------
Kit Api
-------
If you have user access token, you can initialize api instance by it.
.. code-block:: python
>>> from pytiktok import KitApi
>>> kit_api = KitApi(access_token="Your Access Token")
Or you can let user to give permission by `OAuth flow`. See `kit authorization docs <https://sns-sdks.lkhardy.cn/python-tiktok/authorization/kit-authorization/>`_
Now you can get account's data.
Get user info:
.. code-block:: python
>>> kit_api.get_user_info(open_id="User Openid", return_json=True)
>>> # {'data':{'user':{'open_id':'open_id','union_id':'union_id','avatar_url':'https://p16-sign-sg.tiktokcdn.com/tiktok-obj/7046311066329939970~c5_168x168.jpeg?x-expires=1656907200&x-signature=w4%2FugSm2IOdma6p0D9V%2FZneIlPU%3D','display_name':'ki'}},'error':{'code':0,'message':''}}
Get user videos:
.. code-block:: python
>>> kit_api.get_user_videos(open_id="_000Hqnyyz5UYe39YWBZwFnaQGfyaoh3s4IY", return_json=True)
>>> # {'data':{'videos':[{'create_time':1654670085,'share_url':'https://www.tiktok.com/@klein_kunkun/video/7106753891953347842?utm_campaign=tt4d_open_api&utm_source=aw46lwwtsqjeapig','duration':5,'id':'7106753891953347842'},{'create_time':1654658105,'share_url':'https://www.tiktok.com/@klein_kunkun/video/7106702437926407426?utm_campaign=tt4d_open_api&utm_source=aw46lwwtsqjeapig','duration':6,'id':'7106702437926407426'}],'cursor':1654658105000,'has_more':False},'error':{'code':0,'message':''}}
Raw data
{
"_id": null,
"home_page": "https://github.com/sns-sdks/python-tiktok",
"name": "python-tiktok",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.7",
"maintainer_email": null,
"keywords": "tiktok, tiktok sdk, tiktok api",
"author": "ikaroskun",
"author_email": "merle.liukun@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fc/35/a8d61797a8a76c972510e02c5f11e3b61538f6345df1534087679a313b73/python_tiktok-0.1.10.tar.gz",
"platform": null,
"description": "python-tiktok\n\nA simple Python wrapper around for Tiktok API :sparkles: :cake: :sparkles:.\n\n.. image:: https://img.shields.io/badge/TikTok-%23000000.svg?style=for-the-badge&logo=TikTok&logoColor=white\n :target: https://developers.tiktok.com/\n :alt: tiktok\n\n.. image:: https://img.shields.io/pypi/v/python-tiktok.svg\n :target: https://pypi.org/project/python-tiktok/\n :alt: PyPI\n\n============\nIntroduction\n============\n\nThis library provides a service to easily use TikTok official apis.\n\nFor now, include follows apis:\n\n- `TikTok for developers <https://developers.tiktok.com/>`_\n- `TikTok for Business Account <https://ads.tiktok.com/marketing_api/docs?id=1732701966223426>`_\n\n==========\nInstalling\n==========\n\nYou can install this library easily by `pypi`:\n\n.. code-block:: shell\n\n $ pip install python-tiktok\n\nMore installing detail see `Installation docs <https://sns-sdks.lkhardy.cn/python-tiktok/installation/>`_\n\n=====\nUsing\n=====\n\nYou can see more usage detail at `usage docs <https://sns-sdks.lkhardy.cn/python-tiktok/usage/preparation/>`_\n\n----------------\nBusiness Account\n----------------\n\nVersion Tips :\n\n API for Business Version ``1.3`` is now live! visit `here <https://ads.tiktok.com/marketing_api/docs?id=1740579480076290>`_ for more details.\n\n Now this library set default version to ``v1.3``.\n\n And ``v1.2`` will be deprecated on August 15, 2023.\n\nIf you have account access token, you can initialize api instance by it.\n\n.. code-block:: python\n\n >>> from pytiktok import BusinessAccountApi\n >>> business_api = BusinessAccountApi(access_token=\"Your Access Token\")\n\nOr you can let account to give permission by `OAuth flow`. See `business authorization docs <https://sns-sdks.lkhardy.cn/python-tiktok/authorization/business-authorization/>`_\n\nNow you can get account's data.\n\nGet account profile:\n\n.. code-block:: python\n\n >>> business_api.get_account_data(business_id=\"Business ID\", return_json=True)\n >>> # {'code':0,'message':'OK','request_id':'2022070106561301000400402500400500600301500A52386','data':{'display_name':'kiki','profile_image':'https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/accb4aeac4ec812e2bdc45ce1da1ed39~c5_168x168.jpeg?x-expires=1656828000&x-signature=MmXPWeImP%2BRGBwAOqN3wjPpDiZE%3D'}}\n\nIf you set function parameter `return_json` to `True`, will return the json dict data. Otherwise will return a `dataclass` object representing the response.\n\nGet account videos:\n\n.. code-block:: python\n\n >>> business_api.get_account_videos(business_id=\"Business ID\", return_json=True)\n >>> # {'code':0,'message':'OK','request_id':'20220701071724010004003007735002053068B3FD9','data':{'videos':[{'item_id':'7108684822863760646'},{'item_id':'7109064881462152453'}],'has_more':False,'cursor':0}}\n\n-------\nKit Api\n-------\n\nIf you have user access token, you can initialize api instance by it.\n\n.. code-block:: python\n\n >>> from pytiktok import KitApi\n >>> kit_api = KitApi(access_token=\"Your Access Token\")\n\nOr you can let user to give permission by `OAuth flow`. See `kit authorization docs <https://sns-sdks.lkhardy.cn/python-tiktok/authorization/kit-authorization/>`_\n\nNow you can get account's data.\n\nGet user info:\n\n.. code-block:: python\n\n >>> kit_api.get_user_info(open_id=\"User Openid\", return_json=True)\n >>> # {'data':{'user':{'open_id':'open_id','union_id':'union_id','avatar_url':'https://p16-sign-sg.tiktokcdn.com/tiktok-obj/7046311066329939970~c5_168x168.jpeg?x-expires=1656907200&x-signature=w4%2FugSm2IOdma6p0D9V%2FZneIlPU%3D','display_name':'ki'}},'error':{'code':0,'message':''}}\n\nGet user videos:\n\n.. code-block:: python\n\n >>> kit_api.get_user_videos(open_id=\"_000Hqnyyz5UYe39YWBZwFnaQGfyaoh3s4IY\", return_json=True)\n >>> # {'data':{'videos':[{'create_time':1654670085,'share_url':'https://www.tiktok.com/@klein_kunkun/video/7106753891953347842?utm_campaign=tt4d_open_api&utm_source=aw46lwwtsqjeapig','duration':5,'id':'7106753891953347842'},{'create_time':1654658105,'share_url':'https://www.tiktok.com/@klein_kunkun/video/7106702437926407426?utm_campaign=tt4d_open_api&utm_source=aw46lwwtsqjeapig','duration':6,'id':'7106702437926407426'}],'cursor':1654658105000,'has_more':False},'error':{'code':0,'message':''}}\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple Python wrapper for Tiktok API. \u2728 \ud83c\udf70 \u2728",
"version": "0.1.10",
"project_urls": {
"Homepage": "https://github.com/sns-sdks/python-tiktok",
"Repository": "https://github.com/sns-sdks/python-tiktok"
},
"split_keywords": [
"tiktok",
" tiktok sdk",
" tiktok api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "600fc06cd09400747994f15ed814cba2ce14d67518848617e30a201ac37e27a1",
"md5": "2a6048e1edcf8318fbb5cf51835f007e",
"sha256": "7209530b121a9460e42574c213a726140cc2efb46f5925b50792a45a27e7eaf7"
},
"downloads": -1,
"filename": "python_tiktok-0.1.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2a6048e1edcf8318fbb5cf51835f007e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.7",
"size": 15453,
"upload_time": "2024-12-16T07:18:11",
"upload_time_iso_8601": "2024-12-16T07:18:11.225798Z",
"url": "https://files.pythonhosted.org/packages/60/0f/c06cd09400747994f15ed814cba2ce14d67518848617e30a201ac37e27a1/python_tiktok-0.1.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fc35a8d61797a8a76c972510e02c5f11e3b61538f6345df1534087679a313b73",
"md5": "75f5f228909d669485f5f9bd07a8d956",
"sha256": "5c5e4f10102b53a40286184df18b78c9d353c4b339e43d6472dda6dac2f940b4"
},
"downloads": -1,
"filename": "python_tiktok-0.1.10.tar.gz",
"has_sig": false,
"md5_digest": "75f5f228909d669485f5f9bd07a8d956",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.7",
"size": 14638,
"upload_time": "2024-12-16T07:18:13",
"upload_time_iso_8601": "2024-12-16T07:18:13.773791Z",
"url": "https://files.pythonhosted.org/packages/fc/35/a8d61797a8a76c972510e02c5f11e3b61538f6345df1534087679a313b73/python_tiktok-0.1.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-16 07:18:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sns-sdks",
"github_project": "python-tiktok",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "python-tiktok"
}