Skip to content

Commit aac50dc

Browse files
committed
update wrapper.py
1 parent f7afa93 commit aac50dc

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
* 現在、APIは開発途上版です。予告なく互換性のない変更がある可能性をご了承ください。
1616
* put, post, delete系のメソッドを間違えて実行してしまわないよう、注意してください。特に「プロジェクト削除」や「アノテーション仕様更新」のAPIには十分注意してください。
1717

18-
18+
## 廃止予定
19+
* `wraapper.py get_annotation_specs_from_url`
20+
* 廃止理由:過去のアノテーション仕様を`get_annotation_specs`メソッドから取得できるようになったため
21+
* 廃止予定日:2019/11/01以降
1922

2023
# Features
2124
cURLやPostmanなどよりも簡単にAnnoFab Web APIにアクセスできます。

annofabapi/wrapper.py

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import time
55
import urllib
66
import urllib.parse
7+
import warnings
78
from typing import Any, Callable, Dict, List, Optional, Tuple # pylint: disable=unused-import
89

910
import requests
@@ -167,13 +168,16 @@ def get_annotation_specs_from_url(self, project_id: str, url: str) -> Annotation
167168
"""
168169
アノテーション仕様の履歴から取得したURLから、アノテーション仕様を取得する
169170
171+
.. deprecated:: `get_annotation_specs`から過去のアノテーション仕様を取得できるようになったので、廃止する。2019/11/01以降に廃止する予定。
172+
170173
Args:
171174
project_id: プロジェクトID
172175
url: アノテーション仕様の履歴から取得したURL
173176
174177
Returns:
175178
put_annotation_specsのContent
176179
"""
180+
warnings.warn("deprecated", DeprecationWarning)
177181
cookies, _ = self.api._get_signed_cookie(project_id)
178182
kwargs = self.api._create_kwargs()
179183
kwargs.update({"cookies": cookies})

tests/test_api.py

+4
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ def test_annotation_specs():
134134
annotation_specs_histories = api.get_annotation_specs_histories(project_id)[0]
135135
assert type(annotation_specs_histories) == list
136136

137+
annotation_spec, _ = api.get_annotation_specs(
138+
project_id, query_params={"history_id": annotation_specs_histories[0]["history_id"]})
139+
assert type(annotation_spec) == dict
140+
137141
old_annotation_specs_url = annotation_specs_histories[0]["url"]
138142
old_annotation_specs = wrapper.get_annotation_specs_from_url(project_id, old_annotation_specs_url)
139143
assert type(old_annotation_specs) == dict

tests/test_local_utils.py

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import datetime
2-
3-
from annofabapi.utils import to_iso8601_extension
4-
51
# timezonが異なる場所だとテストに失敗するので、コメントアウトする
62
# def test_to_iso8601_extension():
73
# d = datetime.datetime(2019, 10, 8, 16, 20, 8, 241762)

0 commit comments

Comments
 (0)