diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f0f1a85..910ab21 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,6 @@ name: Deploy on: release: types: [published] - workflow_dispatch: jobs: deploy: @@ -20,7 +19,7 @@ jobs: pip install twine wheel - name: Build and publish env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | python setup.py sdist diff --git a/README.md b/README.md index 6af522b..05c4045 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # twitcaspy [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Alma-field/twitcaspy/blob/master/LICENSE) [![test](https://github.com/Alma-field/twitcaspy/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/Alma-field/twitcaspy/actions/workflows/test.yml) +[![Deploy](https://github.com/Alma-field/twitcaspy/actions/workflows/deploy.yml/badge.svg)](https://github.com/Alma-field/twitcaspy/actions/workflows/deploy.yml) [![Documentation Status](https://readthedocs.org/projects/twitcaspy/badge/?version=latest)](http://twitcaspy.alma-field.com/en/latest/?badge=latest) [![GitHub issues open](https://img.shields.io/github/issues/Alma-field/twitcaspy.svg)](https://github.com/Alma-field/twitcaspy/issues?q=is%3Aopen+is%3Aissue) [![GitHub issues close](https://img.shields.io/github/issues-closed-raw/Alma-field/twitcaspy.svg)](https://github.com/Alma-field/twitcaspy/issues?q=is%3Aclose+is%3Aissue) -[![Documentation Status](https://readthedocs.org/projects/twitcaspy/badge/?version=latest)](https://twitcaspy.alma-field.com/ja/latest/?badge=latest) [![PyPI Version](https://img.shields.io/pypi/v/twitcaspy?label=PyPI)](https://pypi.org/project/twitcaspy/) [![Python Versions](https://img.shields.io/pypi/pyversions/twitcaspy?label=Python)](https://pypi.org/project/twitcaspy/) @@ -15,8 +15,8 @@ Twitcatting for Python - [Japanese](https://github.com/Alma-field/twitcaspy/blob/master/README_JA.md) ## Document - - [latest (v1.0.0)](https://twitcaspy.alma-field.com/en/latest) - - [v1.0.0](https://twitcaspy.alma-field.com/en/1.0.0) + - [latest (v1.0.1)](https://twitcaspy.alma-field.com/en/latest) + - [v1.0.1](https://twitcaspy.alma-field.com/en/1.0.1) ## Installation The easiest way to install the latest version from PyPI is by using pip: diff --git a/README_JA.md b/README_JA.md index 4ae80ea..56d2e4a 100644 --- a/README_JA.md +++ b/README_JA.md @@ -1,10 +1,10 @@ # twitcaspy [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Alma-field/twitcaspy/blob/master/LICENSE) [![test](https://github.com/Alma-field/twitcaspy/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/Alma-field/twitcaspy/actions/workflows/test.yml) +[![Deploy](https://github.com/Alma-field/twitcaspy/actions/workflows/deploy.yml/badge.svg)](https://github.com/Alma-field/twitcaspy/actions/workflows/deploy.yml) [![Documentation Status](https://readthedocs.org/projects/twitcaspy/badge/?version=latest)](http://twitcaspy.alma-field.com/ja/latest/?badge=latest) [![GitHub issues open](https://img.shields.io/github/issues/Alma-field/twitcaspy.svg)](https://github.com/Alma-field/twitcaspy/issues?q=is%3Aopen+is%3Aissue) [![GitHub issues close](https://img.shields.io/github/issues-closed-raw/Alma-field/twitcaspy.svg)](https://github.com/Alma-field/twitcaspy/issues?q=is%3Aclose+is%3Aissue) -[![Documentation Status](https://readthedocs.org/projects/twitcaspy/badge/?version=latest)](https://twitcaspy.alma-field.com/ja/latest/?badge=latest) [![PyPI Version](https://img.shields.io/pypi/v/twitcaspy?label=PyPI)](https://pypi.org/project/twitcaspy/) [![Python Versions](https://img.shields.io/pypi/pyversions/twitcaspy?label=Python)](https://pypi.org/project/twitcaspy/) @@ -15,9 +15,8 @@ Python用Twitcattingクライアントライブラリ - [Japanese/日本語](README_JA.md) ## ドキュメント - - "Read The Docs"ドキュメントは準備中です。 - - [最新版 (v1.0.0)](https://twitcaspy.alma-field.com/ja/latest) - - [v1.0.0](https://twitcaspy.alma-field.com/ja/1.0.0) + - [最新版 (v1.0.1)](https://twitcaspy.alma-field.com/ja/latest) + - [v1.0.1](https://twitcaspy.alma-field.com/ja/1.0.1) ## インストール PyPIから最新バージョンはpipを用いてインストールできます。 diff --git a/cassettes/testgetsupportingstatus.json b/cassettes/testgetsupportingstatus.json new file mode 100644 index 0000000..34cd5a2 --- /dev/null +++ b/cassettes/testgetsupportingstatus.json @@ -0,0 +1,85 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://apiv2.twitcasting.tv/users/182224938/supporting_status?target_user_id=twitcasting_dev", + "body": "null", + "headers": { + "User-Agent": [ + "Python/3.9.1 Requests/2.25.1 twitcaspy/1.0.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Api-Version": [ + "2.0" + ], + "Content-Length": [ + "4" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 02 Oct 2021 06:57:38 GMT" + ], + "Connection": [ + "close" + ], + "Set-Cookie": [ + "PHPSESSID=gh1nedp7be36plp7nlflpape53; path=/" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "Thu, 19 Nov 1981 08:52:00 GMT" + ], + "X-RateLimit-Limit": [ + "60" + ], + "Content-Length": [ + "439" + ], + "X-RateLimit-Reset": [ + "1633157918" + ], + "X-WE-ARE-HIRING": [ + "https://about.moi.st/ja/recruit/" + ], + "X-RateLimit-Remaining": [ + "59" + ], + "Strict-Transport-Security": [ + "max-age=0" + ], + "Cache-Control": [ + "no-store, no-cache, must-revalidate, post-check=0, pre-check=0" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Apache" + ] + }, + "body": { + "string": "{\"is_supporting\":false,\"supported\":null,\"target_user\":{\"id\":\"1025221958827311105\",\"screen_id\":\"twitcasting_dev\",\"name\":\"\u30c4\u30a4\u30ad\u30e3\u30b9DEV\",\"image\":\"http://imagegw02.twitcasting.tv/image3s/pbs.twimg.com/profile_images/1025280415228026880/-RWjIg9M_bigger.jpg\",\"profile\":\"\u958b\u767a\u8005\u5411\u3051\u306e\u60c5\u5831\u3092\u3054\u6848\u5185\u3059\u308b\u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u3059\u3002\",\"level\":1,\"last_movie_id\":null,\"is_live\":false,\"supporter_count\":0,\"supporting_count\":0,\"created\":0}}" + } + } + } + ] +} diff --git a/docs/locale/ja/LC_MESSAGES/api.po b/docs/locale/ja/LC_MESSAGES/api.po index d7bb312..69d5fbc 100644 --- a/docs/locale/ja/LC_MESSAGES/api.po +++ b/docs/locale/ja/LC_MESSAGES/api.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: twitcaspy 0.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-06-26 11:58+0900\n" +"POT-Creation-Date: 2021-10-02 16:29+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Alma-field\n" "Language-Team: LANGUAGE \n" @@ -93,7 +93,7 @@ msgstr "指定されたparserがParserインスタンスではない場合" #: twitcaspy.api.API.get_current_live:26 twitcaspy.api.API.get_gifts:16 #: twitcaspy.api.API.get_live_thumbnail_image:24 #: twitcaspy.api.API.get_movie_info:20 twitcaspy.api.API.get_movies_by_user:33 -#: twitcaspy.api.API.get_rtmp_url:16 twitcaspy.api.API.get_supporting_status:21 +#: twitcaspy.api.API.get_rtmp_url:16 twitcaspy.api.API.get_supporting_status:23 #: twitcaspy.api.API.get_user_info:22 twitcaspy.api.API.get_webhook_list:34 #: twitcaspy.api.API.get_webm_url:14 twitcaspy.api.API.incoming_webhook:27 #: twitcaspy.api.API.post_comment:26 twitcaspy.api.API.register_webhook:31 @@ -481,7 +481,7 @@ msgstr "戻り値の型" #: twitcaspy.api.API.get_comments:29 twitcaspy.api.API.get_current_live:21 #: twitcaspy.api.API.get_gifts:13 twitcaspy.api.API.get_movie_info:17 #: twitcaspy.api.API.get_movies_by_user:28 twitcaspy.api.API.get_rtmp_url:13 -#: twitcaspy.api.API.get_supporting_status:16 +#: twitcaspy.api.API.get_supporting_status:18 #: twitcaspy.api.API.get_user_info:17 twitcaspy.api.API.get_webhook_list:31 #: twitcaspy.api.API.get_webm_url:11 twitcaspy.api.API.incoming_webhook:22 #: twitcaspy.api.API.post_comment:21 twitcaspy.api.API.register_webhook:25 @@ -500,7 +500,7 @@ msgstr "" #: of twitcaspy.api.API.get_current_live:23 #: twitcaspy.api.API.get_live_thumbnail_image:21 #: twitcaspy.api.API.get_movies_by_user:30 -#: twitcaspy.api.API.get_supporting_status:18 +#: twitcaspy.api.API.get_supporting_status:20 #: twitcaspy.api.API.get_user_info:19 twitcaspy.api.API.supporting_list:26 msgid "If both id and screen_id are not specified" msgstr "idとscreen_idの両方が指定されていないとき" @@ -1161,27 +1161,35 @@ msgstr "" msgid "Gets the status of whether a user is a supporter of another user." msgstr "ユーザーが、ある別のユーザのサポーターであるかの状態を取得する。" -#: of twitcaspy.api.API.get_supporting_status:10 +#: of twitcaspy.api.API.get_supporting_status:9 +msgid "| target user id or screen_id" +msgstr "対象ユーザの id または screen_id" + +#: of twitcaspy.api.API.get_supporting_status +msgid "target user id or screen_id" +msgstr "対象ユーザの id または screen_id" + +#: of twitcaspy.api.API.get_supporting_status:12 msgid "" "| |attribute| | |latelimit| | **is_supporting** : " -":class:`~twitcaspy.models.Raw` (:class:`bool`) Whether it is a " -"supporter. | **target_user** : :class:`~twitcaspy.models.User` Target " -"user information" +":class:`~twitcaspy.models.Raw` (:class:`bool`) The status of whether " +"(id/screen_id) supported target_user_id. | **target_user** : " +":class:`~twitcaspy.models.User` Target user information" msgstr "" #: of twitcaspy.api.API.get_supporting_status msgid "" "**is_supporting** : :class:`~twitcaspy.models.Raw` (:class:`bool`) " -"Whether it is a supporter." +"The status of whether (id/screen_id) supported target_user_id." msgstr "" "**is_supporting** : :class:`~twitcaspy.models.Raw` (:class:`bool`) " -"サポーターかどうか" +"(id/screen_id)がtarget_user_idをサポートしているかの状況を取得します。" #: of twitcaspy.api.API.get_supporting_status msgid "**target_user** : :class:`~twitcaspy.models.User` Target user information" msgstr "**target_user** : :class:`~twitcaspy.models.User` 対象ユーザ情報" -#: of twitcaspy.api.API.get_supporting_status:22 +#: of twitcaspy.api.API.get_supporting_status:24 msgid "https://apiv2-doc.twitcasting.tv/#get-supporting-status" msgstr "" diff --git a/tests/test_api.py b/tests/test_api.py index 683061e..92e37f9 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -80,6 +80,23 @@ def testgetcomments(self): ok_(hasattr(data, 'all_count')) ok_(hasattr(data, 'comments')) + @tape.use_cassette('testgetsupportingstatus.json') + def testgetsupportingstatus(self): + from twitcaspy.models import User + target_user_id = 'twitcasting_dev' + data = self.api.get_supporting_status( + target_user_id=target_user_id, id=user_id) + ok_(hasattr(data, 'is_supporting')) + ok_(hasattr(data, 'target_user')) + ok_(isinstance(data.target_user, User)) + eq_(data.target_user.screen_id, target_user_id) + + @raises(TwitcaspyException) + @tape.use_cassette('testgetsupportingstatus_raise.json') + def testgetsupportingstatus_raise(self): + target_user_id = 'twitcasting_dev' + data = self.api.get_supporting_status(target_user_id=target_user_id) + @tape.use_cassette('testsupportuser.json') def testsupportuser(self): target_user_ids = ['twitcasting_jp'] diff --git a/twitcaspy/__init__.py b/twitcaspy/__init__.py index fbdde9d..973bb7b 100644 --- a/twitcaspy/__init__.py +++ b/twitcaspy/__init__.py @@ -5,7 +5,7 @@ """ Twitcaspy : Twitcasting API library """ -__version__ = '1.0.0' +__version__ = '1.0.1' __author__ = 'Alma-field' __license__ = 'MIT' diff --git a/twitcaspy/api.py b/twitcaspy/api.py index b07c5df..91e8da2 100644 --- a/twitcaspy/api.py +++ b/twitcaspy/api.py @@ -695,8 +695,9 @@ def get_gifts(self, **kwargs): endpoint_parameters=('slice_id'), **kwargs) @payload(is_supporting=['raw', False], target_user=['user', False]) - def get_supporting_status(self, *, id=None, screen_id=None, **kwargs): - """get_supporting_status(*, id=None, screen_id=None) + def get_supporting_status( + self, target_user_id, *, id=None, screen_id=None, **kwargs): + """get_supporting_status(target_user_id, *, id=None, screen_id=None) | Gets the status of whether a user is a supporter of another user. | |id_screenid| @@ -708,6 +709,8 @@ def get_supporting_status(self, *, id=None, screen_id=None, **kwargs): |id_notice| screen_id: :class:`str` |screen_id| + target_user_id: :class:`str` + | target user id or screen_id Returns ------- @@ -715,7 +718,7 @@ def get_supporting_status(self, *, id=None, screen_id=None, **kwargs): | |attribute| | |latelimit| | **is_supporting** : :class:`~twitcaspy.models.Raw` (:class:`bool`) - Whether it is a supporter. + The status of whether (id/screen_id) supported target_user_id. | **target_user** : :class:`~twitcaspy.models.User` Target user information @@ -732,8 +735,10 @@ def get_supporting_status(self, *, id=None, screen_id=None, **kwargs): if target_id is None: raise TwitcaspyException( 'Either an id or screen_id is required for this method.') + kwargs['target_user_id'] = target_user_id return self.request( - 'GET', f'/users/{target_id}/supporting_status', **kwargs) + 'GET', f'/users/{target_id}/supporting_status', + endpoint_parameters=('target_user_id'), **kwargs) @payload(added_count=['raw', False]) def support_user(self, target_user_ids=None, **kwargs):