Put an strf format for ISO8601 in utils

This commit is contained in:
jesopo 2019-02-12 11:08:24 +00:00
parent 98b82c7f2c
commit 8c9626f0a9
2 changed files with 3 additions and 2 deletions

View file

@ -1,7 +1,6 @@
import datetime, itertools, json, math, urllib.parse import datetime, itertools, json, math, urllib.parse
from src import ModuleManager, utils from src import ModuleManager, utils
_ISO8601 = "%Y-%m-%dT%H:%M:%S%z"
FORM_ENCODED = "application/x-www-form-urlencoded" FORM_ENCODED = "application/x-www-form-urlencoded"
COMMIT_URL = "https://github.com/%s/commit/%s" COMMIT_URL = "https://github.com/%s/commit/%s"
@ -381,7 +380,7 @@ class Module(ModuleManager.BaseModule):
return url return url
def _iso8601(self, s): def _iso8601(self, s):
return datetime.datetime.strptime(s, _ISO8601) return datetime.datetime.strptime(s, utils.ISO8601_FORMAT)
def ping(self, data): def ping(self, data):
return ["Received new webhook"] return ["Received new webhook"]

View file

@ -1,6 +1,8 @@
import decimal, io, ipaddress, re, typing import decimal, io, ipaddress, re, typing
from src.utils import cli, consts, irc, http, parse, security from src.utils import cli, consts, irc, http, parse, security
ISO8601_FORMAT = "%Y-%m-%dT%H:%M:%S%z"
TIME_SECOND = 1 TIME_SECOND = 1
TIME_MINUTE = TIME_SECOND*60 TIME_MINUTE = TIME_SECOND*60
TIME_HOUR = TIME_MINUTE*60 TIME_HOUR = TIME_MINUTE*60