Skip to content

Commit

Permalink
Logger Updated - API Response Print when Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Malith-Rukshan committed Jun 26, 2024
1 parent 75c90bf commit a03afc1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions suno/suno.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def generate(self, prompt, is_custom, tags="", title="", make_instrumental=False

response = self.client.post(
f"{Suno.BASE_URL}/api/generate/v2/", json=payload)
logger.info(response.text)
logger.debug(response.text)

self._cehck_error(response)

Expand Down Expand Up @@ -191,7 +191,7 @@ def get_songs(self, song_ids: List[str] | str = None) -> List[Clip]:
url += f"?ids={songIds}"
logger.info("Getting Songs Info...")
response = self.client.get(url) # Call API
logger.info(response.text)
logger.debug(response.text)
self._cehck_error(response)
return response_to_clips(response.json())

Expand All @@ -209,7 +209,7 @@ def get_song(self, id: str) -> Clip:
logger.info("Getting Song Info...")
response = self.client.get(
f"{Suno.BASE_URL}/api/feed/?ids={id}") # Call API
logger.info(response.text)
logger.debug(response.text)
self._cehck_error(response)
return create_clip_from_data(response.json()[0])

Expand All @@ -230,7 +230,7 @@ def set_visibility(self, song_id: str, is_public: bool) -> bool:
}
response = self.client.post(
f"{Suno.BASE_URL}/api/gen/{song_id}/set_visibility/", json=payload)
logger.info(response.text)
logger.debug(response.text)
if response.status_code == 200:
data = response.json()
return data["is_public"]
Expand All @@ -243,7 +243,7 @@ def get_credits(self) -> CreditsInfo:
logger.info("Credits Info...")
response = self.client.get(
f"{Suno.BASE_URL}/api/billing/info/") # Call API
logger.info(response.text)
logger.debug(response.text)
self._cehck_error(response)
if response.status_code == 200:
data = response.json()
Expand Down

0 comments on commit a03afc1

Please sign in to comment.