Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3655bde

Browse files
1.0.7
1 parent 4c502a4 commit 3655bde

File tree

2 files changed

+62
-10
lines changed

2 files changed

+62
-10
lines changed

‎rocketapi/instagramapi.py

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,21 @@ def request(self, method, data):
3434
elif response["response"]["status_code"] == 404:
3535
raise NotFoundException("Instagram resource not found")
3636
else:
37-
raise BadResponseException("Bad response from Instagram")
38-
raise BadResponseException("Bad response from RocketAPI")
37+
raise BadResponseException(
38+
f"Bad response from Instagram ({method}: {response['response']['status_code']})"
39+
)
40+
raise BadResponseException(f"Bad response from RocketAPI ({method})")
3941

4042
def search(self, query):
4143
"""
4244
Search for a specific user, hashtag or place.
4345
46+
As of September 2024, we no longer recommend using this method, as it now only returns a maximum of 5 users and leaves the places and hashtags arrays empty. Instead, please use the separate methods:
47+
- `search_users`
48+
- `search_hashtags`
49+
- `search_locations`
50+
- `search_audios`
51+
4452
Args:
4553
query (str): The search query
4654
@@ -76,7 +84,7 @@ def get_user_media(self, user_id, count=12, max_id=None):
7684
7785
Args:
7886
user_id (int): User id
79-
count (int): Number of media to retrieve (max: 50)
87+
count (int): Number of media to retrieve (max: 12)
8088
max_id (str): Use for pagination
8189
8290
You can use the `max_id` parameter to paginate through the media (take from the `next_max_id` field of the response).
@@ -179,7 +187,7 @@ def get_user_followers(self, user_id, count=12, max_id=None):
179187
180188
Args:
181189
user_id (int): User id
182-
count (int): Number of users to return (max: 100)
190+
count (int): Number of users to return (max: 50)
183191
max_id (str): Use for pagination
184192
185193
You can use the `max_id` parameter to paginate through followers (take from the `next_max_id` field of the response).
@@ -287,14 +295,14 @@ def get_media_info_by_shortcode(self, shortcode):
287295

288296
def get_media_likes(self, shortcode, count=12, max_id=None):
289297
"""
290-
Retrieve media likes by media shortcode.
298+
Retrieve up to 1000 media likes by media shortcode.
291299
292300
Args:
293301
shortcode (str): Media shortcode
294-
count (int): Number of likers to return (max: 50)
295-
max_id (str): Use for pagination
302+
count (int): Not supported right now
303+
max_id (str): Not supported right now
296304
297-
You can use the `max_id` parameter to paginate through likers (take from the `next_max_id` field of the response).
305+
Pagination is not supported for this endpoint.
298306
299307
For more information, see documentation: https://docs.rocketapi.io/api/instagram/media/get_likes
300308
"""
@@ -505,3 +513,47 @@ def get_user_about(self, user_id):
505513
For more information, see documentation: https://docs.rocketapi.io/api/instagram/user/get_about
506514
"""
507515
return self.request("instagram/user/get_about", {"id": user_id})
516+
517+
def search_users(self, query):
518+
"""
519+
Search for a specific user (max 50 results)
520+
521+
Args:
522+
query (str): The search query
523+
524+
For more information, see documentation: https://docs.rocketapi.io/api/instagram/user/search
525+
"""
526+
return self.request("instagram/user/search", {"query": query})
527+
528+
def search_hashtags(self, query):
529+
"""
530+
Search for a specific hashtag (max 20 results)
531+
532+
Args:
533+
query (str): The search query
534+
535+
For more information, see documentation: https://docs.rocketapi.io/api/instagram/hashtag/search
536+
"""
537+
return self.request("instagram/hashtag/search", {"query": query})
538+
539+
def search_locations(self, query):
540+
"""
541+
Search for a specific location (max 20 results)
542+
543+
Args:
544+
query (str): The search query
545+
546+
For more information, see documentation: https://docs.rocketapi.io/api/instagram/location/search
547+
"""
548+
return self.request("instagram/location/search", {"query": query})
549+
550+
def search_audios(self, query):
551+
"""
552+
Search for a specific audio (max 10 results)
553+
554+
Args:
555+
query (str): The search query
556+
557+
For more information, see documentation: https://docs.rocketapi.io/api/instagram/audio/search
558+
"""
559+
return self.request("instagram/audio/search", {"query": query})

‎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.6",
6+
version="1.0.7",
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.6.tar.gz",
12+
download_url="https://github.com/rocketapi-io/rocketapi-python/archive/refs/tags/v1.0.7.tar.gz",
1313
install_requires=["requests"],
1414
)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /