mirror of
https://github.com/jo1gi/grawlix.git
synced 2026-06-24 06:24:57 -06:00
Add throttle error
This commit is contained in:
parent
fda6455c5f
commit
a8fbb690ec
@ -18,3 +18,6 @@ class SourceNotAuthenticated(GrawlixError):
|
||||
|
||||
class MissingArgument(GrawlixError):
|
||||
pass
|
||||
|
||||
class ThrottleError(GrawlixError):
|
||||
pass
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
from grawlix.book import Book, Metadata, SingleFile, OnlineFile
|
||||
from grawlix import AESEncryption
|
||||
from grawlix.exceptions import ThrottleError
|
||||
|
||||
import re
|
||||
from .source import Source
|
||||
@ -87,11 +88,14 @@ class Saxo(Source):
|
||||
|
||||
:param ebook_id: Id of ebook file
|
||||
:returns: Link to ebook file
|
||||
:raises ThrottleError: If there have been too many downloads
|
||||
"""
|
||||
response = self._session.get(
|
||||
f"https://api-read.saxo.com/api/v1/book/{ebook_id}/content/encryptedstream/"
|
||||
)
|
||||
return response.json()["link"]
|
||||
).json()
|
||||
if not "link" in response:
|
||||
raise ThrottleError
|
||||
return response["link"]
|
||||
|
||||
|
||||
@staticmethod
|
||||
|
||||
Loading…
Reference in New Issue
Block a user