def update_project_status()

in scripts/bulk-update-status.py [0:0]


def update_project_status(headers, timestamp, update_url) -> None:
    #open projects file
    user_input = input(f"Open projects_{timestamp}.json? (y/n): ")
    if user_input.lower() == "y":
        with open(f"projects_{timestamp}.json", "r") as f:
            projects = json.load(f)
    elif user_input.lower() == "n":
        path = input("Enter path to projects file: ")
        with open(path, "r") as f:
            projects = json.load(f)

    if projects:  
        display_projects(projects)
    else:
        print("No records to update")
        return
    print("Change status to: ")
    status = STATUS_STRINGS[get_input()]
    
    confirm = input(f"Do you want to update the status of these projects to \033[32m{status}\033[0m? (y/n): ")
    
    print(confirm.lower())
    if confirm.lower() != "y":
        print("Exiting script")
        return
    
    for project in projects:
        print(project)
        
        request_body = { "status": status }
        json_body = json.dumps(request_body)
        try:
            json_content = api_put_request(
                f"{update_url}/{project['id']}/status",
                headers,
                json_body,
            )
            print(f"Updated record: {project['id']} to {status} {json_content['status']}")
            logging.info(f"record: {project['id']}, status: {json_content['status']}, project status updated to: {status}")
        except requests.exceptions.RequestException as e:
            raise Exception(f"An error occurred. {e} Exiting script...")