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 boto3 | |
import datetime | |
def lambda_handler(event, context): | |
print("Connecting to RDS") | |
client = boto3.client('rds') | |
print("RDS snapshot backups stated at %s...\n" % datetime.datetime.now()) | |
client.create_db_snapshot( | |
DBInstanceIdentifier='web-platform-slave', |
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
# !/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
__author__ = 'Diego Garcia' | |
import tornado.web | |
import tornado.ioloop | |
import oauth2.tokengenerator | |
import oauth2.grant | |
import oauth2.store.redisdb | |
import oauth2.store.mongodb |
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 functools | |
import json | |
import tornado.web | |
from tornado import httpclient | |
from datetime import datetime | |
class TestHandler(tornado.web.RequestHandler): |
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
def shutdown(graceful=True): | |
"""Shut down the application. | |
If a graceful stop is requested, waits for all of the IO loop's | |
handlers to finish before shutting down the rest of the process. | |
We impose a 10 second timeout. | |
""" | |
ioloop = tornado.ioloop.IOLoop.instance() | |
def final_stop(): |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
<title>Stripe Sample Form</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script> | |
<script type="text/javascript" src="https://js.stripe.com/v1/"></script> | |
<script type="text/javascript"> |
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
#Async Version with AsyncHTTPClient as url fetcher | |
from tornado import httpserver, ioloop | |
from tornado.httpclient import AsyncHTTPClient, HTTPClient | |
class httpProxy(): | |
def __init__(self, iolp): | |
self.myserv = httpserver.HTTPServer(self.handle_request) | |
self.myserv.listen(8080) | |
self.httpclient = AsyncHTTPClient() |
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 tornado.ioloop | |
import tornado.web | |
import tornado.httpserver | |
import tornado.httputil | |
import json | |
class MainHandler(tornado.web.RequestHandler): | |
def post(self): | |
# do something useful | |
name = self.get_argument('foo') |