def add_repo(request): if request.method == 'POST': org = request.POST.get("org_manual") ds = request.POST.get("ds_manual") repo = request.POST.get("repo_manual") projects = {org: {ds: [repo]}} load_project(projects) return HttpResponseRedirect('http://127.0.0.1:8000/')
def upload_projects(request): if request.method == 'POST': try: projects_file = request.FILES['projects'] projects = json.loads(projects_file.read().decode('utf-8')) load_project(projects) except json.decoder.JSONDecodeError: pass return HttpResponseRedirect(CONFIGURATION_URL)
def add_repo(request): if request.method == 'POST': org = request.POST.get("org_manual") ds = request.POST.get("ds_manual") repo = request.POST.get("repo_manual") projects = { org: { ds: [ repo ] } } load_project(projects) return HttpResponseRedirect(CONFIGURATION_URL)
def add_orgs(request): if request.method == 'POST': org = request.POST.get("org") token = request.POST.get("github_token") if org == "": return HttpResponseRedirect(CONFIGURATION_URL) github = GitHubSync(token) projects = {} try: projects = github.sync(projects, org) load_project(projects) except requests.exceptions.ConnectionError: print("Conection ERROR") return HttpResponseRedirect(CONFIGURATION_URL)
def add_meetup(request): if request.method == 'POST': org = request.POST.get("meetup_org_name") topic = request.POST.get("meetup_topic") if org == "" or topic == "": return HttpResponseRedirect('http://127.0.0.1:8000/') try: groups = get_groups(topic) projects = {org: {"meetup": groups}} load_project(projects) except requests.exceptions.ConnectionError: print("Conection ERROR") return HttpResponseRedirect('http://127.0.0.1:8000/')
def add_slack(request): if request.method == 'POST': org = request.POST.get("slack_org_name") token = request.POST.get("slack_token") if org == "" or token == "": return HttpResponseRedirect('http://127.0.0.1:8000/') url = 'https://slack.com/api/channels.list?token=' + token + '&pretty=1' try: channels = get_channels(url) projects = {org: {"slack": channels}} load_project(projects) except requests.exceptions.ConnectionError: print("Conection ERROR") return HttpResponseRedirect('http://127.0.0.1:8000/')