def post_back_to_external_events(): if request.method == "POST": event_data = request.get_data('data') event_json = Utils.bytes_to_json(event_data) TaskObjectBuilder.build_task(PlacedTask.get_task( event_json["id"])).save_to_db() PlacedTask.remove_placed_task(event_json["id"]) return render_template("FullCalendar.html")
def update_task(): if request.method == "POST": event_data = request.get_data('data') event_json = Utils.bytes_to_json(event_data) print(event_json) task = TaskObjectBuilder.build_placed_task( PlacedTask.get_task(event_json["id"]), event_json["start"], event_json["end"], session["user_id"]) task.update_task() return render_template("FullCalendar.html")
def post_request(): if request.method == "POST": event_data = request.get_data('data') event_json = Utils.bytes_to_json(event_data) task = TaskObjectBuilder.build_placed_task( Task.get_task(event_json["id"]), event_json["start"], event_json["end"], session["user_id"]) task.save_placed_task() Task.remove_task(event_json["id"]) # add to db.placed_tasks here # delete from db.External_tasks using the id return render_template("FullCalendar.html")
def get_from_teamwork_scaled(actn, name, company_name, key): http = urllib3.PoolManager() company = company_name key = key action = actn url = "https://{0}.teamwork.com/{1}".format(company, action) headers = urllib3.util.make_headers(basic_auth=key + ":xxx") request = http.request('GET', url, headers=headers) data = request.data dic = Utils.bytes_to_json(data) tasks = dic[name] return tasks
def get_from_teamwork(actn, name): http = urllib3.PoolManager() company = "wltc" key = "twp_VJ8lmPZG8cdnAmW1UEYPqbHPzldj" action = actn url = "https://{0}.teamwork.com/{1}".format(company, action) headers = urllib3.util.make_headers(basic_auth=key + ":xxx") request = http.request('GET', url, headers=headers) data = request.data dic = Utils.bytes_to_json(data) tasks = dic[name] return tasks
from src.common import Utils http = urllib3.PoolManager() company = "wltc" key = "twp_VJ8lmPZG8cdnAmW1UEYPqbHPzldj" action = "tasks.json" url = "https://{0}.teamwork.com/{1}".format(company, action) headers = urllib3.util.make_headers(basic_auth=key + ":xxx") request = http.request('GET', url, headers=headers) response = request.status data = request.data dic = Utils.bytes_to_json(data) tasks = dic["todo-items"] for task in tasks: print(task) """ What we need from each task - id - start-date - due-date - description - content - project-name - project-id (if we want to do put/post requests) - todo-list-name (task-list name)