Skip to content

Instantly share code, notes, and snippets.

@tnuki10
tnuki10 / gist:ef577424a66e62c597eb
Last active December 6, 2015 05:39
Google App Engine for GoでのDeadlineの変更
import (
"appengine"
"appengine/urlfetch"
)
// 中省略
c := appengine.NewContext(r)
client := urlfetch.Client(c)
// deadline変更
transport := &urlfetch.Transport{
@tnuki10
tnuki10 / gist:8081b945ab8db0f95f38
Last active August 29, 2015 14:14
GAEからGoogle Cloud Storage Go Client Libraryを利用(認証)
// google.golang.org/cloud でcontextを作ると、GCPの各サービス用のライブラリが使えるようになるっぽい。
c := appengine.NewContext(r)
tokenSource := google.AppEngineTokenSource(c, storage.ScopeFullControl)
client := oauth2.NewClient(
c,
tokenSource,
)
ctx := cloud.NewContext(appengine.AppID(c), client)
@tnuki10
tnuki10 / app.yaml
Last active December 20, 2015 01:49
kindleへメールマガジンを転送するためのプログラムをGoogle App Engine for Pythonで作ってみた。 GAEでのメールの取り扱いは、こちらを参照。 https://developers.google.com/appengine/docs/python/mail/ Google Cloud Storageは、こちらを参照。 https://developers.google.com/appengine/docs/python/googlecloudstorageclient/
# 以下のパスを追加
# 受信用メールアドレスは、こちらを参照。
# https://developers.google.com/appengine/docs/python/mail/receivingmail
url: /_ah/mail/受信用メールアドレス
script: handle_sendkindle.app
login: admin
@tnuki10
tnuki10 / The URL template(webapp2)
Last active December 17, 2015 18:39
webapp2でThe URL templateを使ってみるサンプル。 動かしていないので、これで動くかどうかは分かりませんが、こんな感じで使えそう。
class aaaa(webapp2.handler):
def get(self, path1, path2=None, path3=None)
if path2 is None:
path2='defult'
if path3 is None:
path3='defult'
app = webapp2.WSGIApplication([
webapp2.Route(r'/<path1>/<path2>/<path3>', handler=aaaa),
@tnuki10
tnuki10 / gist:5387275
Created April 15, 2013 10:48
Twilioのクイックスタート
# -*- coding: utf-8 -*-
import webapp2
import logging
from twilio.util import TwilioCapability
import twilio.twiml
from app.handlers.common import comJinja2
from app.handlers.message_config import *