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 socket | |
import asyncio | |
from urllib.parse import urlsplit | |
async def get(url): | |
url = urlsplit(url) | |
hostname = url.hostname | |
if url.scheme == 'https': | |
port = url.port or 443 |
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
from bottle import route, run, response, request | |
import datetime | |
import json | |
import requests | |
# Cache middleware | |
def cache(callback, ttl=datetime.timedelta(hours=1)): | |
cache = {} | |
def wrapper(*args, **kwargs): | |
key = request.path |
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
# Require PyJwt, AIOHTTP and PyCrypto (for RS256 in JWT) | |
import jwt | |
import time | |
import json | |
from pprint import pprint | |
import aiohttp | |
import asyncio |
NewerOlder