Skip to content

Commit c538ede

Browse files
committed
1.0.15
1 parent 1141d24 commit c538ede

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

rocketapi/instagramapi.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def request(self, method, data):
3131
if response["status"] == "done":
3232
if method in ["instagram/media/get_shortcode_by_id", "instagram/media/get_id_by_shortcode"]:
3333
return response
34-
34+
3535
if (
3636
response["response"]["status_code"] == 200
3737
and response["response"]["content_type"] == "application/json"
@@ -393,22 +393,32 @@ def get_media_likes_by_id(self, media_id):
393393
"""
394394
return self.request("instagram/media/get_likes_by_id", {"id": media_id})
395395

396-
def get_media_comments(self, media_id, can_support_threading=True, min_id=None):
396+
def get_media_comments(
397+
self, media_id, can_support_threading=True, min_id=None, order=None
398+
):
397399
"""
398400
Retrieve media comments by media id.
399401
400402
Args:
401403
media_id (int): Media id
402404
can_support_threading (bool): Set `False` if you want chronological order
403405
min_id (str): Use for pagination
406+
order (int): Comments order: 0 - popular (default), 1 - most recent, 2 - verified. Requires `can_support_threading` to be `True`
404407
405408
You can use the `min_id` parameter to paginate through comments (take from the `next_min_id` field of the response).
406409
407410
For more information, see documentation: https://docs.rocketapi.io/api/instagram/media/get_comments
408411
"""
412+
if order is not None:
413+
if not can_support_threading:
414+
raise ValueError("order requires can_support_threading to be True")
415+
if order not in (0, 1, 2):
416+
raise ValueError("order must be 0, 1 or 2")
409417
payload = {"id": media_id, "can_support_threading": can_support_threading}
410418
if min_id is not None:
411419
payload["min_id"] = min_id
420+
if order is not None:
421+
payload["order"] = order
412422
return self.request("instagram/media/get_comments", payload)
413423

414424
def get_media_shortcode_by_id(self, media_id):

rocketapi/rocketapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, token, max_timeout=30):
1111
For more information, see documentation: https://docs.rocketapi.io/api/
1212
"""
1313
self.base_url = "https://v1.rocketapi.io/"
14-
self.sdk_version = "1.0.14"
14+
self.sdk_version = "1.0.15"
1515
self.token = token
1616
self.max_timeout = max_timeout
1717

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
setuptools.setup(
55
name="rocketapi",
6-
version="1.0.14",
6+
version="1.0.15",
77
author="RocketAPI",
88
author_email="developer@rocketapi.io",
99
description="RocketAPI Python SDK",
1010
packages=["rocketapi"],
1111
url="https://github.com/rocketapi-io/rocketapi-python",
12-
download_url="https://github.com/rocketapi-io/rocketapi-python/archive/refs/tags/v1.0.14.tar.gz",
12+
download_url="https://github.com/rocketapi-io/rocketapi-python/archive/refs/tags/v1.0.15.tar.gz",
1313
install_requires=["requests"],
1414
)

0 commit comments

Comments
 (0)