https://github.com/sknepal/PacktPub-grabber
Grabs Free Learning eBook from PacktPub (everyday) & notifies You via Email.
https://github.com/sknepal/PacktPub-grabber
ebook packt packtpub packtpub-grabber
Last synced: 11 months ago
JSON representation
Grabs Free Learning eBook from PacktPub (everyday) & notifies You via Email.
- Host: GitHub
- URL: https://github.com/sknepal/PacktPub-grabber
- Owner: sknepal
- Created: 2016-08-20T13:33:23.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-10-06T07:14:42.000Z (over 8 years ago)
- Last Synced: 2024-08-06T03:03:20.828Z (almost 2 years ago)
- Topics: ebook, packt, packtpub, packtpub-grabber
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 23
- Watchers: 4
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PacktPub Grabber
Grabs [Today's Free Learning eBook from PacktPub](https://www.packtpub.com/packt/offers/free-learning) & notifies you via Email.
## Dependencies
```sh
pip install -r requirements.txt
```
Or, on Arch Linux:
```sh
pip2 install -r requirements.txt
```
## Configuration
Steps to configure the script.
#### PacktPub Account Information
Replace USERNAME and PASSWORD on line 8 and 9 with your PacktPub username (email address) and password.
```python
br.form["email"] = "USERNAME"
br.form["password"] = "PASSWORD"
```
#### Email Account Information
The script sends the email from a Gmail address you specify to your another email address. Note that, only Gmail account is accepted for sending email. I'd advise not to use your existing Gmail account since you need to enable access for less secure apps.
* Create a new Gmail account.
* [Enable access for less secure apps](https://support.google.com/accounts/answer/6010255?hl=en) on the (new) sending Gmail account.
* Replace the "FROM", "TO", and "EMAIL PASSWORD" on the last line with your sending Gmail address, receiving Email address and the sending Gmail account's password respectively.
```python
send_email("FROM", "TO", "PacktPub Grabber", outcome, "EMAIL PASSWORD")
```
After each run, you'll receive an email in the "TO" address with the success/failure message.

## Run
Two ways to go about running the script.
#### Manually
To run manually, simply go to the shell and type:
```python
python /path/to/packtpub-grabber/packtpub-grabber.py
```
#### Automatically
Since the purpose of the script is to automate the whole process of getting a free Ebook everyday, you should choose an automated way. So, put the script on your VPS and then setup a cron job so that the script runs everyday on the given time.
Run _crontab -e_ and add the following lines to run the script everday at 6.30 PM.
```
30 6 * * * python /path/to/packtpub-grabber/packtpub-grabber.py 2>>errors.log
```
The errors, if any, can be viewed on errors.log file.