Skip to content

Commit

Permalink
[added] Better error message when the download URL for supported form…
Browse files Browse the repository at this point in the history
…ats can't be found. It will help to debug #1.
  • Loading branch information
TnS-hun committed Apr 27, 2019
1 parent be5ffd4 commit a391363
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kobo-book-downloader/Kobo.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,12 @@ def __GetDownloadInfo( productId: str, contentAccessBookResponse: dict ) -> Tupl
hasDrm = jsonContentUrl[ "DRMType" ] == "KDRM"
return jsonContentUrl[ "DownloadUrl" ], hasDrm

raise KoboException( "Download URL for supported formats can't be found for product '%s'." % productId )
message = "Download URL for supported formats can't be found for product '%s'.\n" % productId
message += "Available formats:"
for jsonContentUrl in jsonContentUrls:
message += "\nDRMType: '%s', UrlFormat: '%s'" % ( jsonContentUrl[ "DRMType" ], jsonContentUrl[ "UrlFormat" ] )

raise KoboException( message )

def __DownloadToFile( self, url, outputPath: str ) -> None:
response = self.Session.get( url, stream = True )
Expand Down

0 comments on commit a391363

Please sign in to comment.