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
| class RateLimitTimeMiddleware(object): | |
| def __init__(self, app): | |
| self.app = app | |
| def __call__(self, environ, start_response): | |
| if environ.get('HTTP_X_APPENGINE_COUNTRY', '??') in ['KW', 'CN']: | |
| start_response('429 Too Many Requests', [('Content-type', 'text/html')]) | |
| return ["""<html><head><title>429 Too Many Requests, sorry...</title> | |
| <style>body { font-family: verdana, arial, sans-serif; background-color: #fff; color: #000; }</style> | |
| </head><body><div style="margin-left: 4em;"><h1>We're sorry...</h1> |
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
| class UeCheckin2(gaetk.handler.BasicHandler): | |
| def put(self, uuid): | |
| key = "sekrit" # determined by some other process | |
| bodyhash = base64.b64encode(hashlib.sha256(self.request.body).digest()) | |
| toBeSigned = "&".join([self.request.method, self.request.path, bodyhash]) | |
| signature = base64.b64encode(hmac.new(key, toBeSigned, hashlib.sha256).digest()) | |
| header = self.request.headers['Authorization'] | |
| typ, value = header.split() | |
| if typ != 'X-Signature': | |
| raise gaetk.handler.HTTP401_Unauthorized |
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
| def ig2adn(profile): | |
| logging.debug(profile) | |
| instagram_client = InstagramAPI(access_token=profile.ig_access_token) | |
| try: | |
| media, next = instagram_client.user_recent_media() | |
| except InstagramAPIError, msg: | |
| if 'The "access_token" provided is invalid.' in str(msg): | |
| # profile.ig_access_token = None | |
| # profile.put() | |
| return |
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
| # Dateien, die wir strenger checken. | |
| STRICT_LINT_FILES= views/admin.py modules/beliza | |
| # Alle Projektdateien | |
| LINT_FILES= $(STRICT_LINT_FILES) *.py controllers/ modules/ views/ bin/import_rechnung.py | |
| LINT_LINE_LENGTH= 110 | |
| LINT_FLAKE8_ARGS= --max-complexity=18 --builtins=_ --max-line-length=$(LINT_LINE_LENGTH) | |
| GOOD_NAMES=_,setUp,application,fd,gaetk_replication_SQL_INSTANCE_NAME,gaetk_replication_SQL_DATABASE_NAME,gaetk_replication_SQL_QUEUE_NAME |
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
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| """ | |
| paffrater.py - Dieses Progrtamm liesst Volksbank Kontoauszüge und konvertiert sie in OFX. | |
| OFX wurde mit xero.com getestet. | |
| Created by Maximillian Dornseif on 2010-06-05. | |
| Copyright (c) 2010, 2013 HUDORA. All rights reserved. | |
| """ |
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
| (* Script to record and tag spotify tracks, by Lloyd Moore *) | |
| (* Modified by Tiffany G. Wilson to resolve audio splitting issues, automate starting/stopping, and add recording customization *) | |
| (* Modified by github.com/duggi on 7/18/2014 -- replace slash with dashin new filename to prevent directory write errors *) | |
| (* Snippets for controlling Spotify are from Johnny B on tumblr (http://johnnyb.tumblr.com/post/25716608379/spotify-offline-playlist) *) | |
| (* The idea of using delayed tagging/filename updating is from a guest user on pastebin (http://pastebin.com/rHqY0qg9) *) | |
| (* The only thing to change in the script is the output format; you must change the file extension and the recording format to match *) | |
| (* Run this script once a song you want to record is queued (stopped at beginning) or playing *) | |
| (* Running the script will initiate hijacking, recording and audio playback *) | |
| (* To stop script, pause Spotify or wait for album/playlist to end*) | |
| (* To set id3 tags, use application Kid3 (http://sourceforge.net/pr |
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
| mistakenot-2:appengine-toolkit md$ git diff | |
| diff --git i/gaetk/handler.py w/gaetk/handler.py | |
| index aeb7ebe..e50d63d 100755 | |
| --- i/gaetk/handler.py | |
| +++ w/gaetk/handler.py | |
| @@ -24,10 +24,12 @@ import base64 | |
| import datetime | |
| import hashlib | |
| import os | |
| +import string |
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
| diff --git i/modules/market/mk_forms.py w/modules/market/mk_forms.py | |
| index dd3646a..e78a8d8 100644 | |
| --- i/modules/market/mk_forms.py | |
| +++ w/modules/market/mk_forms.py | |
| @@ -6,6 +6,8 @@ modules/market/mk_forms.py | |
| Created by Christian Klein on 2015-12-01. | |
| Copyright (c) 2015 HUDORA GmbH. All rights reserved. | |
| """ | |
| +import logging | |
| + |
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
| diff --git i/modules/market/mk_controllers.py w/modules/market/mk_controllers.py | |
| index 6334a83..90903ce 100644 | |
| --- i/modules/market/mk_controllers.py | |
| +++ w/modules/market/mk_controllers.py | |
| @@ -16,6 +16,7 @@ from google.appengine.ext import ndb | |
| from huTools import postmark | |
| import config | |
| + | |
| from modules import bot |
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
| def versionsverbesserung_fuer_sofort([{'artnr': menge}, ...]): | |
| ret = defaultdict(0) | |
| erfuellbar = True | |
| # wir koennen ja theoretisch mehrfach auf den selben Artikel zugreifen | |
| # deswegen merken wir uns, was wir schon an freier menge "verbruacht" | |
| # haben. | |
| freimengenspeicher = {} | |
| for artnr, menge in ...: | |
| eap = get_eap(artnr) | |
| if eap.fuer_kunde: |