This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import | |
import datetime | |
from ndb import model | |
from webapp2_extends.utils import Unique, UniqueConstraintViolation, \ | |
check_password_hash, generate_password_hash | |
from webapp2_extends.auth import create_session_id | |
DEBUG = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Based on https://github.com/ikasamah/withings-garmin/blob/master/withings.py | |
import urllib | |
from datetime import datetime | |
import urlparse | |
import oauth2 as oauth | |
try: | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2, urllib | |
import logging | |
def send_mail_sendgrid(from, to, subject, body): | |
base_url = 'https://sendgrid.com/api/mail.send.json' | |
params = { | |
'api_user': 'you@you.com', | |
'api_key': 'yourpassword', | |
'from': from, | |
'to': to, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import | |
import datetime | |
from ndb import model | |
from webapp2_extends.utils import Unique, UniqueConstraintViolation, \ | |
check_password_hash, generate_password_hash | |
from webapp2_extends.auth import create_session_id | |
DEBUG = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import models | |
from wtforms import Form | |
from wtforms import fields | |
from wtforms import validators | |
class PasswordRestForm(Form): | |
email = fields.TextField('email') | |
class PasswordChangeForm(Form): | |
current = fields.PasswordField('Current Password') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.appengine.api import ( | |
apiproxy_stub_map, | |
quota | |
) | |
import logging | |
def _log_api_pre_call(service, call, request, response, rpc): | |
logging.debug('RPC(pre) %s.%s', service, call) | |
def _log_api_post_call(service, call, request, response, rpc, error): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deploy: dependencies check | |
# index must be clean (no modified files) | |
git diff-index --quiet --cached HEAD | |
# no uncomitted changes | |
git diff-files --quiet | |
# create a branch for the current version | |
git branch -f deploy_`grep -E '^version: ' app.yaml | cut -d ' ' -f 2` | |
# push current code to that branch | |
git push -f . deploy_`grep -E '^version: ' app.yaml | cut -d ' ' -f 2` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os | |
package_dir = "packages" | |
sys.path.insert(0, package_dir) | |
for filename in os.listdir(package_dir): | |
if filename.endswith((".zip", ".egg")): | |
sys.path.insert(0, "%s/%s" % (package_dir, filename)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################### | |
# allow scripts to use appengine apis | |
# | |
# assumes you store your data in a "data" directory | |
# in your app directory. See connect_local_datastore() | |
# and assumes that you have a HRD app id with "~" | |
###################################################### | |
# | |
# locate app-engine SDK: | |
AE_PATH = "/your/path/to/sdk/google_appengine/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import with_statement | |
import functools | |
import os | |
import sys | |
from fabric.api import * | |
from fabric.colors import green, red, green | |
import datetime | |
import re |