docs: http://sublimetext.info/docs/en/reference/key_bindings.html
| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| # -*- 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 |
| # -*- 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 |
| 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': '[email protected]', | |
| 'api_key': 'yourpassword', | |
| 'from': from, | |
| 'to': to, |
| 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') |
| # -*- 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 |
| 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` |
| 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): |
| 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)) |
docs: http://sublimetext.info/docs/en/reference/key_bindings.html
| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ###################################################### | |
| # 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/" |