Skip to content

Instantly share code, notes, and snippets.

@someone1
someone1 / cloud_endpoints_swagger_auth.go
Created March 23, 2018 17:27
Google Cloud Endpoints authentication with go-swagger generated server
// CloudEndpointsUserInfo represents the data passed by the ESP in Google's Cloud Endpoints Service
type CloudEndpointsUserInfo struct {
Issuer string `json:"issuer"`
ID string `json:"id"`
Email string `json:"email"`
}
// CloudEndPointsWrapper will try to extract the ESP header and add it as a scope - NOT IDEAL
func CloudEndPointsWrapper(name string, authenticate security.ScopedTokenAuthentication) runtime.Authenticator {
const header = "X-Endpoint-API-UserInfo"
@someone1
someone1 / shard_test.py
Created July 10, 2012 17:34
Testing code for reliabily saving hundreds of transactions on GAE
import webapp2
import decimal
import logging
import random
import string
from google.appengine.api import datastore_errors
from google.appengine.datastore import entity_pb
from google.appengine.ext import db
@someone1
someone1 / delete_tests.py
Created February 2, 2012 19:06
Testing async delete with NDB
from google.appengine.ext.ndb import model, context, tasklets
from random import choice
import string
from werkzeug import Response
class Items(model.Model):
user = model.StringProperty()
@classmethod
@tasklets.tasklet