Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding integer overflow issue #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions ansible/roles/api/files/vAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@
from lxml import etree
from bottle import route, run, request, debug

@route('/time', method="POST")
def check_time():

data = request.body.read()
val = json.loads(data)

if 'epoch' not in val:
response = {'Error':'Pass timestamp with variable \'epoch\' '}
else:
epoch = float(val['epoch'])
print epoch
struct_time = time.localtime(epoch)
response = {'Epoch to structured time':
{
'Year': struct_time.tm_year,
'Month': struct_time.tm_mon,
'Day' : struct_time.tm_mday,
'Hour' : struct_time.tm_hour,
'Minute' : struct_time.tm_min,
'second' : struct_time.tm_sec
}
}
return json.dumps(response, sort_keys=True, indent=2)

@route('/', method='GET')
def get_root():
Expand Down