Merge pull request #10 from taladar/master
Fix #9 Timezone error when calculating age of scan
This commit is contained in:
Коммит
dfa6690cad
|
@ -8,6 +8,7 @@ from sys import exit
|
|||
|
||||
import argparse
|
||||
import datetime
|
||||
import pytz
|
||||
import json
|
||||
import requests
|
||||
import sys
|
||||
|
@ -61,7 +62,13 @@ def analyze(host):
|
|||
|
||||
# Print out a notification on stderr that it's a cached result
|
||||
# I hate working with datetime so much
|
||||
differential = datetime.datetime.now() - datetime.datetime.strptime(scan['end_time'], '%a, %d %b %Y %H:%M:%S %Z')
|
||||
differential = datetime.datetime.now(pytz.utc) - \
|
||||
pytz.timezone('GMT').localize(
|
||||
datetime.datetime.strptime(
|
||||
scan['end_time'],
|
||||
'%a, %d %b %Y %H:%M:%S %Z'
|
||||
)
|
||||
)
|
||||
differential = differential.days * 86400 + differential.seconds
|
||||
|
||||
if differential > 300:
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
requests
|
||||
pytz
|
||||
|
|
3
setup.py
3
setup.py
|
@ -20,7 +20,8 @@ setup(
|
|||
license='MPL 2.0',
|
||||
long_description=README,
|
||||
install_requires=[
|
||||
'requests'
|
||||
'requests',
|
||||
'pytz'
|
||||
],
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
|
|
Загрузка…
Ссылка в новой задаче