Commit 63996d3a authored by abuddenberg's avatar abuddenberg
Browse files

Refactored config file handling to module-level. hitlist files now created in...

Refactored config file handling to module-level. hitlist files now created in current directory (better than crash; will fix later)
parent cb0eb50d
......@@ -14,13 +14,14 @@ gcis = GcisClient('http://data-stage.globalchange.gov', 'andrew.buddenberg@noaa.
def main():
hitlist_file = '../hitlist.pk1'
hitlist_file = 'hitlist.pk1'
# create_problem_list('nca3', hitlist_file)
# print_problem_list(hitlist_file)
solve_problems(hitlist_file, 'nca3')
# print_ready_list(hitlist_file)
def solve_problems(path, report_id):
problems = load_problem_list(path)
......
from gcis_client import GcisClient
from webform_client import WebformClient
from os.path import expanduser, exists
from os import makedirs
def default_image_dir():
image_dir = expanduser('~/.gcis-py-client/images/')
if not exists(image_dir):
makedirs(image_dir)
return image_dir
......@@ -2,8 +2,7 @@
import urllib
import re
from os.path import join, expanduser, exists
from os import makedirs
from os.path import join
import requests
from dateutil.parser import parse
......@@ -22,18 +21,18 @@ def sanitized(pattern):
return dec
def build_image_dir():
image_dir = expanduser('~/.gcis-py-client/images/')
if not exists(image_dir):
makedirs(image_dir)
return image_dir
class WebformClient:
def __init__(self, url, token, local_image_dir=None, remote_dir='/system/files/'):
self.base_url = url
self.token = token
self.images_dir = local_image_dir if local_image_dir else build_image_dir()
if local_image_dir:
self.images_dir = local_image_dir
else:
from gcis_clients import default_image_dir
self.images_dir = default_image_dir()
self.remote_image_dir = remote_dir
def get_list(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment