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 urllib2 | |
from flask import Flask, redirect, request | |
from tbk.webpay.commerce import Commerce | |
from tbk.webpay.confirmation import Confirmation | |
from tbk.webpay.payment import Payment | |
app = Flask(__name__) | |
commerce = Commerce(testing=True) | |
server_ip = urllib2.urlopen('http://ip.42.pl/raw').read() |
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 | |
import speedtest # pip install speedtest-cli | |
import requests # pip install requests | |
IFTTT_URL = 'https://maker.ifttt.com/trigger/{event}/with/key/{key}' | |
IFTTT_KEY = '<IFTTT_KEY>' # get from iftt webhook service | |
DOWNLOAD_THRESHOLD = 20 |
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
''' | |
usage: python list_top_level_modules.py | tr "\n" "\0" | xargs -n1 -0 -i{} git grep {} -- '*.py' | grep import | |
''' | |
import os | |
import importlib | |
import site | |
def main(): |
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
from django.conf import settings as django_settings | |
class Setting(object): | |
def __init__(self, name): | |
self.name = name | |
def __get__(self, instance, owner): | |
return self.get_value() |
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
class SoapRequestor(object): | |
def request(self, method_name, *args, **kwargs): | |
try: | |
request = SoapRequest( | |
method_name=method_name, | |
args=args, | |
kwargs=kwargs | |
) | |
self.logger.info("Starting request to method `%s`", method_name) |
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
class ZeepWsseSignature(object): | |
def apply(self, envelope, headers): | |
sign_envelope(envelope, self.key) | |
return envelope, headers | |
def verify(self, envelope): | |
if not verify_envelope(envelope, self.tbk_cert): | |
raise InvalidSignatureResponse() | |
return envelope |
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
class OneClickPaymentService(TBKWebService): | |
def init_inscription(self, username, email, response_url): | |
arguments = { | |
'username': username, | |
'email': email, | |
'responseURL': response_url | |
} | |
one_click_inscription_input = self.soap_requestor.create_object('oneClickInscriptionInput', **arguments) |
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
# coding: utf-8 | |
import urllib | |
import urllib2 | |
import json | |
from hashlib import sha1 | |
def check_email(email, truncate_response=True): | |
''' |
OlderNewer