From 23dd0a58b6069d4e85edcfc2baed823201d976db Mon Sep 17 00:00:00 2001 From: Daniel Borup Date: Tue, 16 Apr 2019 16:49:20 -0500 Subject: [PATCH 1/3] Gitlab V4 API needs to use HTTPS --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6bf0755..d8fa833 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ A weekly backup of your GitLab initiated by the cron at 3am each Saturday would look something like this (assuming BackupHub.py is in your PATH): ``` -0 3 * * 6 BackupHub.py --path ~/backup --token --website http://gitlab.com --move-aside --ignore-errors >> ~/backup/BackupHub.log +0 3 * * 6 BackupHub.py --path ~/backup --token --website https://gitlab.com --move-aside --ignore-errors >> ~/backup/BackupHub.log ``` or for GitHub: From 98e73b4dff43b9c2e9ba73327e58abc7ccf7f67a Mon Sep 17 00:00:00 2001 From: Daniel Borup Date: Tue, 16 Apr 2019 16:52:06 -0500 Subject: [PATCH 2/3] Require python-gitlab >1.3.0 where V4 API is default --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index de7c9c0..69caa6e 100644 --- a/environment.yml +++ b/environment.yml @@ -7,5 +7,5 @@ channels: dependencies: - python=3.5 - pip: - - python-gitlab==0.13 + - python-gitlab>=1.3.0 - PyGithub==1.26.0 From d637805eec9cedc994bfdd4faf59911c6575e433 Mon Sep 17 00:00:00 2001 From: Daniel Borup Date: Tue, 16 Apr 2019 17:08:27 -0500 Subject: [PATCH 3/3] Explicitly limit backup to projects where user is a member --- BackupHub.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BackupHub.py b/BackupHub.py index 7918195..9cec713 100755 --- a/BackupHub.py +++ b/BackupHub.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Author: Nick Zwart # Date: 2016jun01 # Backup all the projects of a git-hub style website via git mirroring. @@ -48,7 +48,7 @@ def __init__(self, token, url): self._gl.auth() # list all projects - self._projects = self._gl.projects.list(all=True) + self._projects = self._gl.projects.list(membership=True) def numProjects(self): return len(self._projects)