Skip to content

Commit

Permalink
Handle HTTP headers independent of their case
Browse files Browse the repository at this point in the history
Closes aprikyan#11.
  • Loading branch information
marieell authored Feb 12, 2022
1 parent 36c222d commit 8e50f72
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ def get_cookie(url):

for request in driver.requests:
if request.headers:
if "Cookie" in request.headers.keys():
cookies.append(request.headers["Cookie"])
for k, v in request.headers.items():
if k.lower() == "cookie":
cookies.append(v)
break

return cookies[0]

Expand Down

1 comment on commit 8e50f72

@GruS3
Copy link

@GruS3 GruS3 commented on 8e50f72 Jun 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With those changes i moved beyond the 4th step (it fixed the error wich was appearing after i typed 'all' selecting the range of pages), but then it crashes after i type the final directory of the book (it creates a blank folder) with the following crash log:

Traceback (most recent call last):
File "C:\google-books-downloader-master\gbd.py", line 232, in
step3()
File "C:\google-books-downloader-master\gbd.py", line 218, in step3
download_imgs(selected_pages, cookie, new_directory)
File "C:\google-books-downloader-master\gbd.py", line 146, in download_imgs
for number, url in bar(pages.items()):
TypeError: 'module' object is not callable

@marieell @aprikyan

Please sign in to comment.