Skip to content

Commit 8543e91

Browse files
author
ykumi
authored
Merge pull request #45 from nttpc/release/1.2.2
Release/1.2.2
2 parents eb039de + d167d59 commit 8543e91

File tree

7 files changed

+202
-106
lines changed

7 files changed

+202
-106
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 19.10b0
3+
rev: 20.8b1
44
hooks:
55
- id: black
66

@@ -13,7 +13,7 @@ repos:
1313
- flake8-docstrings==1.5.0
1414

1515
- repo: https://github.com/timothycrosley/isort
16-
rev: 5.4.2
16+
rev: 5.5.2
1717
hooks:
1818
- id: isort
1919

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Change Log
22

3-
Unreleased
3+
## 1.2.2
4+
5+
Released 2020-09-14
46

57
- Changed User-Agent on HTTP request to anymotion-sdk/x.y.z.
68

anymotion_sdk/client.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,23 @@ def get_one_data(self, endpoint: str, endpoint_id: int) -> dict:
113113
return response.json
114114

115115
def get_image(self, image_id: int) -> dict:
116-
"""Get image data."""
116+
"""Get image data.
117+
118+
Gets a single image data.
119+
If you want to get more than one image data, use `get_images`.
120+
121+
Same as requesting GET /images/{image_id} directly.
122+
"""
117123
return self.get_one_data("images", image_id)
118124

119125
def get_movie(self, movie_id: int) -> dict:
120-
"""Get movie data."""
126+
"""Get movie data.
127+
128+
Gets a single movie data.
129+
If you want to get more than one movie data, use `get_movies`.
130+
131+
Same as requesting GET /movies/{movie_id} directly.
132+
"""
121133
return self.get_one_data("movies", movie_id)
122134

123135
def get_keypoint(self, keypoint_id: int, join_data: bool = False) -> dict:

anymotion_sdk/session.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def __init__(
4141
self.request_callbacks: List[Callable] = []
4242
self.response_callbacks: List[Callable] = []
4343

44+
self.user_agent = f"anymotion-sdk/{__version__}"
45+
4446
def request(
4547
self,
4648
url: str,
@@ -62,14 +64,19 @@ def request(
6264
raise RequestsError("HTTP method is invalid.")
6365

6466
headers = headers or {}
65-
headers["User-Agent"] = f"anymotion-sdk/{__version__}"
67+
headers["User-Agent"] = self.user_agent
6668
if json:
6769
headers["Content-Type"] = "application/json"
6870
if token:
6971
headers["Authorization"] = f"Bearer {token}"
7072

7173
request = requests.Request(
72-
method, url, params=params, data=data, json=json, headers=headers,
74+
method,
75+
url,
76+
params=params,
77+
data=data,
78+
json=json,
79+
headers=headers,
7380
)
7481
prepped = request.prepare()
7582

0 commit comments

Comments
 (0)