This file contains hidden or 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
''' | |
Application to demonstrate testing tornado websockets. | |
Try it wiith: python -m tornado.testing discover | |
''' | |
from tornado import testing, httpserver, gen, websocket | |
from ws import APP |
This file contains hidden or 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
# vim: fileencoding=utf-8 | |
import time, signal | |
from tornado import web, ioloop, options, httpserver | |
_SHUTDOWN_TIMEOUT = 30 | |
def make_safely_shutdown(server): | |
io_loop = server.io_loop or ioloop.IOLoop.instance() | |
def stop_handler(*args, **keywords): | |
def shutdown(): |
This file contains hidden or 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 time | |
import tornado | |
from tornado.concurrent import run_on_executor | |
from concurrent.futures import ThreadPoolExecutor # `pip install futures` for python2 | |
from tornado.httpserver import HTTPServer | |
from tornado.ioloop import IOLoop | |
from tornado.web import Application, RequestHandler | |
from tornado import gen |
This file contains hidden or 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 asyncio | |
import base64 | |
import hashlib | |
from japronto.app import Application | |
class NaiveWsBaseProtocol(asyncio.Protocol): | |
@staticmethod | |
def accept(key): |
This file contains hidden or 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
<!-- | |
How to use Google JS Visualization Api offline, step by step | |
this approach might work with other libraries loaded with google.load, after all it's still JavaScript!!! | |
--> | |
<!DOCTYPE html> | |
<html> |
This file contains hidden or 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
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"io" | |
"net" | |
"net/http" | |
"os" |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"github.com/ego008/selenium" | |
"net" | |
"time" | |
"os" | |
) |
This file contains hidden or 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
package main | |
import ( | |
agwd "github.com/sclevine/agouti" | |
tbwd "github.com/tebeka/selenium" | |
"log" | |
sgwd "sourcegraph.com/sourcegraph/go-selenium" | |
) | |
// Helper for sourcegraph/go-selenium |
This file contains hidden or 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
// Exemplo de requisição GET | |
var ajax = new XMLHttpRequest(); | |
// Seta tipo de requisição e URL com os parâmetros | |
ajax.open("GET", "minha-url-api.com/?name=Henry&lastname=Ford", true); | |
// Envia a requisição | |
ajax.send(); | |
// Cria um evento para receber o retorno. |
This file contains hidden or 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
package main | |
// ex $ curl --proxy http://127.0.0.1:12345 -L https://www.google.com | |
import ( | |
"bytes" | |
"io" | |
"log" | |
"net" | |
"net/url" |