Skip to content

Commit

Permalink
Merge pull request #12 from Alma-field/develop
Browse files Browse the repository at this point in the history
Release v1.0.1
  • Loading branch information
Alma-field committed Oct 2, 2021
2 parents 1c7ebb3 + 8f490ac commit b63e297
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 25 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Deploy
on:
release:
types: [published]
workflow_dispatch:

jobs:
deploy:
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/)

Expand All @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions README_JA.md
Original file line number Diff line number Diff line change
@@ -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/)

Expand All @@ -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を用いてインストールできます。
Expand Down
85 changes: 85 additions & 0 deletions cassettes/testgetsupportingstatus.json
Original file line number Diff line number Diff line change
@@ -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}}"
}
}
}
]
}
30 changes: 19 additions & 11 deletions docs/locale/ja/LC_MESSAGES/api.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>\n"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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の両方が指定されていないとき"
Expand Down Expand Up @@ -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 ""

Expand Down
17 changes: 17 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion twitcaspy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
Twitcaspy : Twitcasting API library
"""
__version__ = '1.0.0'
__version__ = '1.0.1'
__author__ = 'Alma-field'
__license__ = 'MIT'

Expand Down
13 changes: 9 additions & 4 deletions twitcaspy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -708,14 +709,16 @@ 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
-------
:class:`~twitcaspy.models.Result`
| |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
Expand All @@ -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):
Expand Down

0 comments on commit b63e297

Please sign in to comment.