Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Returns
-------
HttpResponse object
Outgoing response sent to the webpage
"""
# Check if GET or POST request
if request.method == 'POST':
# Connect to databas
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
package_dir = __location__.split('website')[0]
database_location = os.path.join(package_dir, 'database')
database_file = os.path.join(database_location, 'miri_database.db')
conn = sql.create_connection(database_file)
c = conn.cursor()
# check if new item or delete item
if '_newItem' in request.POST:
# gat form
formAdd = addAnomalyForm_Miri(request.POST)
if formAdd.is_valid():
Autor = str(formAdd.cleaned_data['name'])
start = str(formAdd.cleaned_data['starttime'])
end = str(formAdd.cleaned_data['endtime'])
plot = str(formAdd.cleaned_data['select_plot'])
comment = str(formAdd.cleaned_data['comment'])
# convert time
request : HttpRequest object
Incoming request from the webpage
Returns
-------
HttpResponse object
Outgoing response sent to the webpage
"""
# Check if GET or POST request
if request.method == 'POST':
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
package_dir = __location__.split('website')[0]
database_location = os.path.join(package_dir, 'database')
database_file = os.path.join(database_location, 'nirspec_database.db')
conn = sql.create_connection(database_file) # get variables
c = conn.cursor()
# check if new item or delete item
if '_newItem' in request.POST:
# gat form
formAdd = addAnomalyForm_nir(request.POST)
if formAdd.is_valid():
Autor = str(formAdd.cleaned_data['name'])
start = str(formAdd.cleaned_data['starttime'])
end = str(formAdd.cleaned_data['endtime'])
plot = str(formAdd.cleaned_data['select_plot'])
comment = str(formAdd.cleaned_data['comment'])
# convert time
start = float(Time(start, format='iso').mjd)
def main():
db_file = "miri_database.db"
conn = sql.create_connection(db_file)
plot_power_ice(conn, "output/power_ice.html")
sql.close_connection(conn)
print('end')
def main():
max_time = 90
step_time = 0.5
# get date
today = date.today()
day = today - datetime.timedelta(days=10)
day = day.strftime("%Y-%m-%d")
# connect database
DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'miri_database.db')
conn = sql.create_connection(DATABASE_FILE)
# define token
secrets = netrc.netrc()
mast_token = secrets.authenticators(host)[2]
day = '2019-10-15'
day = '2019-12-10'
# define time
start_time = Time(day + ' 12:00:00.000', format='iso')
end_time = Time(day + ' 12:15:00.000', format='iso')
# define time
start_time = Time(day + ' 00:00:00.001', format='iso')
end_time = Time(day + ' 23:59:59.000', format='iso')
def main():
max_time = 90
step_time = 0.5
# get date
today = date.today()
day = today - datetime.timedelta(days=10)
day = day.strftime("%Y-%m-%d")
# connect database
DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'miri_database.db')
conn = sql.create_connection(DATABASE_FILE)
# define token
secrets = netrc.netrc()
mast_token = secrets.authenticators(host)[2]
# define time
start_time = Time(day + ' 12:00:00.000', format='iso')
end_time = Time(day + ' 12:15:00.000', format='iso')
# querry data 15 min STARTED
print("*************************************************************")
print("* querry data 15 min STARTED")
print("*************************************************************")
# go over all nmemonics
for mnemonic_name in mn.mnemonic_set_15min:
def main():
db_file = "miri_database.db"
conn = sql.create_connection(db_file)
plot_volt4(conn, "output/volt4.html")
sql.close_connection(conn)
print('end')
def main():
#generate paths
DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'miri_database.db')
#connect to temporary database
conn = sql.create_connection(DATABASE_FILE)
#process every csv file in directory folder
for path in paths:
process_file(conn, path)
#close connection
sql.close_connection(conn)
print("done")