rocketapi 1.0.6__tar.gz → 1.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rocketapi
3
- Version: 1.0.6
3
+ Version: 1.0.8
4
4
  Summary: RocketAPI Python SDK
5
5
  Home-page: https://github.com/rocketapi-io/rocketapi-python
6
- Download-URL: https://github.com/rocketapi-io/rocketapi-python/archive/refs/tags/v1.0.6.tar.gz
6
+ Download-URL: https://github.com/rocketapi-io/rocketapi-python/archive/refs/tags/v1.0.8.tar.gz
7
7
  Author: RocketAPI
8
8
  Author-email: developer@rocketapi.io
@@ -34,13 +34,22 @@ class InstagramAPI(RocketAPI):
34
34
  elif response["response"]["status_code"] == 404:
35
35
  raise NotFoundException("Instagram resource not found")
36
36
  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})")
39
41
 
40
42
  def search(self, query):
41
43
  """
42
44
  Search for a specific user, hashtag or place.
43
45
 
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
+ - `search_clips`
52
+
44
53
  Args:
45
54
  query (str): The search query
46
55
 
@@ -76,7 +85,7 @@ class InstagramAPI(RocketAPI):
76
85
 
77
86
  Args:
78
87
  user_id (int): User id
79
- count (int): Number of media to retrieve (max: 50)
88
+ count (int): Number of media to retrieve (max: 12)
80
89
  max_id (str): Use for pagination
81
90
 
82
91
  You can use the `max_id` parameter to paginate through the media (take from the `next_max_id` field of the response).
@@ -94,7 +103,7 @@ class InstagramAPI(RocketAPI):
94
103
 
95
104
  Args:
96
105
  user_id (int): User id
97
- count (int): Number of media to retrieve (max: 50)
106
+ count (int): Number of media to retrieve (max: 12)
98
107
  max_id (str): Use for pagination
99
108
 
100
109
  You can use the `max_id` parameter to paginate through the media (take from the `max_id` (!) field of the response).
@@ -179,7 +188,7 @@ class InstagramAPI(RocketAPI):
179
188
 
180
189
  Args:
181
190
  user_id (int): User id
182
- count (int): Number of users to return (max: 100)
191
+ count (int): Number of users to return (max: 50)
183
192
  max_id (str): Use for pagination
184
193
 
185
194
  You can use the `max_id` parameter to paginate through followers (take from the `next_max_id` field of the response).
@@ -287,14 +296,14 @@ class InstagramAPI(RocketAPI):
287
296
 
288
297
  def get_media_likes(self, shortcode, count=12, max_id=None):
289
298
  """
290
- Retrieve media likes by media shortcode.
299
+ Retrieve up to 1000 media likes by media shortcode.
291
300
 
292
301
  Args:
293
302
  shortcode (str): Media shortcode
294
- count (int): Number of likers to return (max: 50)
295
- max_id (str): Use for pagination
303
+ count (int): Not supported right now
304
+ max_id (str): Not supported right now
296
305
 
297
- You can use the `max_id` parameter to paginate through likers (take from the `next_max_id` field of the response).
306
+ Pagination is not supported for this endpoint.
298
307
 
299
308
  For more information, see documentation: https://docs.rocketapi.io/api/instagram/media/get_likes
300
309
  """
@@ -367,7 +376,7 @@ class InstagramAPI(RocketAPI):
367
376
  """
368
377
  return self.request("instagram/location/get_info", {"id": location_id})
369
378
 
370
- def get_location_media(self, location_id, page=None, max_id=None):
379
+ def get_location_media(self, location_id, page=None, max_id=None, tab=None):
371
380
  """
372
381
  Retrieve location media by location id.
373
382
 
@@ -375,6 +384,7 @@ class InstagramAPI(RocketAPI):
375
384
  location_id (int): Location id
376
385
  page (int): Page number
377
386
  max_id (str): Use for pagination
387
+ tab (str): Tab name: recent, ranked (default: recent)
378
388
 
379
389
  In order to use pagination, you need to use both the `max_id` and `page` parameters. You can obtain these values from the response's `next_page` and `next_max_id` fields.
380
390
 
@@ -385,6 +395,8 @@ class InstagramAPI(RocketAPI):
385
395
  payload["page"] = page
386
396
  if max_id is not None:
387
397
  payload["max_id"] = max_id
398
+ if tab is not None:
399
+ payload["tab"] = tab
388
400
  return self.request("instagram/location/get_media", payload)
389
401
 
390
402
  def get_hashtag_info(self, name):
@@ -492,6 +504,23 @@ class InstagramAPI(RocketAPI):
492
504
  payload["max_id"] = max_id
493
505
  return self.request("instagram/audio/get_media", payload)
494
506
 
507
+ def get_audio_media_by_canonical_id(self, audio_canonical_id, max_id=None):
508
+ """
509
+ Retrieve audio media by audio canonical id.
510
+
511
+ Args:
512
+ audio_canonical_id (int): Audio canonical id
513
+ max_id (str): Use for pagination
514
+
515
+ You can use the `max_id` parameter to paginate through media (take from the `next_max_id` field of the response).
516
+
517
+ For more information, see documentation: https://docs.rocketapi.io/api/instagram/audio/get_media_by_canonical_id
518
+ """
519
+ payload = {"id": audio_canonical_id}
520
+ if max_id is not None:
521
+ payload["max_id"] = max_id
522
+ return self.request("instagram/audio/get_media_by_canonical_id", payload)
523
+
495
524
  def get_user_about(self, user_id):
496
525
  """
497
526
  Obtain user details from «About this Account» section.
@@ -505,3 +534,58 @@ class InstagramAPI(RocketAPI):
505
534
  For more information, see documentation: https://docs.rocketapi.io/api/instagram/user/get_about
506
535
  """
507
536
  return self.request("instagram/user/get_about", {"id": user_id})
537
+
538
+ def search_users(self, query):
539
+ """
540
+ Search for a specific user (max 50 results)
541
+
542
+ Args:
543
+ query (str): The search query
544
+
545
+ For more information, see documentation: https://docs.rocketapi.io/api/instagram/user/search
546
+ """
547
+ return self.request("instagram/user/search", {"query": query})
548
+
549
+ def search_hashtags(self, query):
550
+ """
551
+ Search for a specific hashtag (max 20 results)
552
+
553
+ Args:
554
+ query (str): The search query
555
+
556
+ For more information, see documentation: https://docs.rocketapi.io/api/instagram/hashtag/search
557
+ """
558
+ return self.request("instagram/hashtag/search", {"query": query})
559
+
560
+ def search_locations(self, query):
561
+ """
562
+ Search for a specific location (max 20 results)
563
+
564
+ Args:
565
+ query (str): The search query
566
+
567
+ For more information, see documentation: https://docs.rocketapi.io/api/instagram/location/search
568
+ """
569
+ return self.request("instagram/location/search", {"query": query})
570
+
571
+ def search_audios(self, query):
572
+ """
573
+ Search for a specific audio (max 10 results)
574
+
575
+ Args:
576
+ query (str): The search query
577
+
578
+ For more information, see documentation: https://docs.rocketapi.io/api/instagram/audio/search
579
+ """
580
+ return self.request("instagram/audio/search", {"query": query})
581
+
582
+ def search_clips(self, query):
583
+ """
584
+ Search for a specific clip with a caption that includes the query (max 12 results)
585
+
586
+ Args:
587
+ query (str): The search query
588
+
589
+ For more information, see documentation: https://docs.rocketapi.io/api/instagram/media/search_clips
590
+ """
591
+ return self.request("instagram/media/search_clips", {"query": query})
@@ -11,6 +11,7 @@ class RocketAPI:
11
11
  For more information, see documentation: https://docs.rocketapi.io/api/
12
12
  """
13
13
  self.base_url = "https://v1.rocketapi.io/"
14
+ self.version = "1.0.8"
14
15
  self.token = token
15
16
  self.max_timeout = max_timeout
16
17
 
@@ -18,6 +19,9 @@ class RocketAPI:
18
19
  return requests.post(
19
20
  url=self.base_url + method,
20
21
  json=data,
21
- headers={"Authorization": f"Token {self.token}"},
22
+ headers={
23
+ "Authorization": f"Token {self.token}",
24
+ "User-Agent": f"RocketAPI Python SDK/{self.version}",
25
+ },
22
26
  timeout=self.max_timeout,
23
27
  ).json()
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rocketapi
3
- Version: 1.0.6
3
+ Version: 1.0.8
4
4
  Summary: RocketAPI Python SDK
5
5
  Home-page: https://github.com/rocketapi-io/rocketapi-python
6
- Download-URL: https://github.com/rocketapi-io/rocketapi-python/archive/refs/tags/v1.0.6.tar.gz
6
+ Download-URL: https://github.com/rocketapi-io/rocketapi-python/archive/refs/tags/v1.0.8.tar.gz
7
7
  Author: RocketAPI
8
8
  Author-email: developer@rocketapi.io
@@ -3,12 +3,12 @@ import setuptools
3
3
 
4
4
  setuptools.setup(
5
5
  name="rocketapi",
6
- version="1.0.6",
6
+ version="1.0.8",
7
7
  author="RocketAPI",
8
8
  author_email="developer@rocketapi.io",
9
9
  description="RocketAPI Python SDK",
10
10
  packages=["rocketapi"],
11
11
  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.8.tar.gz",
13
13
  install_requires=["requests"],
14
14
  )
File without changes
File without changes
File without changes