A simple Python script for claim free book from PacktPub, and also download from your library.
First, install all requirements, run following command in root folder:
pip3 install -r requirements.txt
Second, you can check with help of file:
python3 script.py -h
You must config your credential.json
before you do everything. You can easily make from sample by:
cp credential.json.example credential.json
Please put your user name after "name":
and your password after "pass":
-
If you just want to claim a free book:
python3 script.py -c
-
If you want to notify yourself with ifttt webhook:
You have to config the
ifttt
field incredential.json
file. If you don't know what is a key or what is IFTTT, please check with IFTTT - Webhook.python3 script.py -n ifttt
-
If you want to notify yourself with mailgun email service:
You have to config the
mailgun
field incredential.json
file. You can go to Mailgun to register for a new account (which is free). After login, you can find your api key on your dashboard (findPrivate API Key
in page ) and domain name after clickingDomain
tab. If you don't have any domain yourself, the sandbox domain is good to use.python3 script.py -n mailgun
-
If you just want to download a book (first book in your library):
python3 script.py -d 1
-
If you want to download a book with type epub (default is pdf) to desktop:
python3 script.py -d 1 -t epub --dir ~/Desktop/
-
If you want to claim and then download:
python3 script.py -c -d 1
-
If you want to upload to dropbox:
You have to config
dropbox
field incredential.json
file. You can go to Dropbox Developers to create an app for this use. You do have to generateaccess token
and put intocredential.json
file.Note: Upload choice must be used as same time at download
python3 script.py -d 1 -u dropbox
- Add Google Drive support
- Download book from multiple pages