<commit_before>Send a card to Google Glass daily via App Engine + Cron
================

This sample is an App Engine application that sends a daily card to Google Glass. It uses Google+ Sign In to handle authentication and then uses App Engine's cron to send a card to uses at the defined time.

### Prerequisites

1. Create a new project in the [Google Developers Console](https://console.developers.google.com),
2. Enable Mirror API and Google+ API. Note, this differs from the other Glass quickstarts (they make reference to the deprecated profile.info scope and don't require Google+).
3. Create a new client id for web application under APIs & auth > Credentials. Make sure to add your redirect uri as http://localhost:8080/oauth2callback for local testing and https://SOMENAME.appspot.com/oauth2callback for deployment.

### Setup

1. Clone this repo
```
git clone https://github.com/justinribeiro/glass-daily-card.git
```

2. Install the requirements so that our project will run (Flask, kvsession, httplib2, et cetera)
```
pip install -r requirements.txt -t lib

3. Replace client_secrets.json with the credentials you created in step 3 of the prerequisites (use "Download JSON" button).
4. Replace the content for the google-signin-clientid meta tag in templates/base.html with your web application client id. Maybe visit the link in the comment above that line and learn more about page level configuration for Google+ Sign In.
5. Run the application via
```
dev_appserver.py .
```
6. Browse to http://localhost:8080/ to see the application running.

### Scheduling cards to send

Because this is a bare bones sample application, it has no admin interface. Instead, we rely on the Datastore Viewer to manage the  CronCards data. To get started:

1. Create a CronCard. The model, while defined in the application (see models.py), doesn't exist in the datastore because we have inserted any data. To do so, visit http://localhost:8080/samplesforcron which will insert a single CronCard into our datastore with the date set to today.
2. Edit or Adding CronCards. By navigating to the local admin panel (http://localhost:8000/) we can view, edit and add to the CronCards data store as needed. This would be under the "Cloud Datastore" in production App Engine.

### Running the cron job

1. The cron job is scheduled via cron.yaml. To understand more about how cron works on App Engine, I highly recommend the [documentation](https://developers.google.com/appengine/docs/python/config/cron).
2. In development, the cron job will not run at the defined time. You need to kick the job off manually to test via the local admin console http://localhost:8000/

### General questions
Some general questions that are highly likely to come up.<commit_msg>Fix readme :-)<commit_after>Send a card to Google Glass daily via App Engine + Cron
================

This sample is an App Engine application that sends a daily card to Google Glass. It uses Google+ Sign In to handle authentication and then uses App Engine's cron to send a card to uses at the defined time.

### Prerequisites

1. Create a new project in the [Google Developers Console](https://console.developers.google.com),
2. Enable Mirror API and Google+ API. Note, this differs from the other Glass quickstarts (they make reference to the deprecated profile.info scope and don't require Google+).
3. Create a new client id for web application under APIs & auth > Credentials. Make sure to add your redirect uri as http://localhost:8080/oauth2callback for local testing and https://SOMENAME.appspot.com/oauth2callback for deployment.

### Setup

1. Clone this repo
```
git clone https://github.com/justinribeiro/glass-daily-card.git
```

2. Install the requirements so that our project will run (Flask, kvsession, httplib2, et cetera)
```
pip install -r requirements.txt -t lib
```
3. Replace client_secrets.json with the credentials you created in step 3 of the prerequisites (use "Download JSON" button).
4. Replace the content for the google-signin-clientid meta tag in templates/base.html with your web application client id. Maybe visit the link in the comment above that line and learn more about page level configuration for Google+ Sign In.
5. Change the application project id in app.yaml.
6. Run the application via
```
dev_appserver.py .
```
6. Browse to http://localhost:8080/ to see the application running.

### Scheduling cards to send

Because this is a bare bones sample application, it has no admin interface. Instead, we rely on the Datastore Viewer to manage the  CronCards data. To get started:

1. Create a CronCard. The model, while defined in the application (see models.py), doesn't exist in the datastore because we have inserted any data. To do so, visit http://localhost:8080/samplesforcron which will insert a single CronCard into our datastore with the date set to today.
2. Edit or Adding CronCards. By navigating to the local admin panel (http://localhost:8000/) we can view, edit and add to the CronCards data store as needed. This would be under the "Cloud Datastore" in production App Engine.

### Running the cron job

1. The cron job is scheduled via cron.yaml. To understand more about how cron works on App Engine, I highly recommend the [documentation](https://developers.google.com/appengine/docs/python/config/cron).
2. In development, the cron job will not run at the defined time. You need to kick the job off manually to test via the local admin console http://localhost:8000/

### General questions
Some general questions that are highly likely to come up.
{'fraction_non_alphanumeric': 0.07317511686443726, 'fraction_numerical': 0.01348435814455232, 'mean_word_length': 4.313276026743075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6022956', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1406, 'n_words': 805}