Skip to content

Commit f92c904

Browse files
author
Yusuke Kumihashi
committed
change user_agent to instance variable and update docstring
1 parent 2ddda9f commit f92c904

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

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: 3 additions & 1 deletion
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,7 +64,7 @@ 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:

0 commit comments

Comments
 (0)