Skip to content

Commit c10fe0b

Browse files
committed
Tox format
1 parent 16ad007 commit c10fe0b

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

kobodl/actions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def ListBooks(users: List[User], listAll: bool, exportFile: Union[TextIO, None])
160160
Owner=user,
161161
)
162162

163+
163164
def Login(user: User) -> None:
164165
'''perform device initialization and get token'''
165166
kobo = Kobo(user)

kobodl/app.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ def users():
2323
user = User(Email=email)
2424
try:
2525
activation_url, activation_code = actions.InitiateLogin(user)
26-
return jsonify({
27-
'activation_url': 'https://www.kobo.com/activate',
28-
'activation_code': activation_code,
29-
'check_url': activation_url,
30-
'email': email
31-
})
26+
return jsonify(
27+
{
28+
'activation_url': 'https://www.kobo.com/activate',
29+
'activation_code': activation_code,
30+
'check_url': activation_url,
31+
'email': email,
32+
}
33+
)
3234
except Exception as err:
3335
error = str(err)
3436
else:
@@ -42,7 +44,7 @@ def check_activation():
4244
data = request.get_json()
4345
check_url = data.get('check_url')
4446
email = data.get('email')
45-
47+
4648
if not check_url or not email:
4749
return jsonify({'error': 'Missing required parameters'}), 400
4850

kobodl/kobo.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,14 @@ def __GetDownloadInfo(
273273
for key in download_keys:
274274
download_url = jsonContentUrl.get(key, None)
275275
if download_url:
276-
parsed = urllib.parse.urlparse( download_url )
277-
parsedQueries = urllib.parse.parse_qs( parsed.query )
278-
parsedQueries.pop( "b", None ) # https://github.com/TnS-hun/kobo-book-downloader/commit/54a7f464c7fdf552e62c209fb9c3e7e106dabd85
279-
download_url = parsed._replace( query = urllib.parse.urlencode( parsedQueries, doseq = True ) ).geturl()
276+
parsed = urllib.parse.urlparse(download_url)
277+
parsedQueries = urllib.parse.parse_qs(parsed.query)
278+
parsedQueries.pop(
279+
"b", None
280+
) # https://github.com/TnS-hun/kobo-book-downloader/commit/54a7f464c7fdf552e62c209fb9c3e7e106dabd85
281+
download_url = parsed._replace(
282+
query=urllib.parse.urlencode(parsedQueries, doseq=True)
283+
).geturl()
280284
return download_url, hasDrm
281285

282286
message = f"Download URL for supported formats can't be found for product '{productId}'.\n"

0 commit comments

Comments
 (0)