Repository: PyGithub/PyGithub

Issue:
Add archival support for Repository.edit
In November 2017, github added the ability to archive a repository via the edit REST API

https://developer.github.com/changes/2017-11-08-archiving-repositories/

The change looks to be relatively simple - I'm just a little hung up on generating the replay file


Discussion:
This will be useful! How can I help？
@sfdye I just get antsy any time I see code wanting passwords and such ☺️

Any procedures / best practices / things to not do?

I guess what I'm think of right now is generating a temporary token, generate the replay, and then delete the token?
You could. According to the docs:
https://github.com/PyGithub/PyGithub/blob/master/CONTRIBUTING.md#automated-tests

You can generate a personal token and run the test with `--record --auth_with_token`. That's it :)

Resolving patch:
diff --git a/github/Repository.py b/github/Repository.py
--- a/github/Repository.py
+++ b/github/Repository.py
@@ -1161,7 +1161,7 @@ def delete(self):
             self.url
         )
 
-    def edit(self, name=None, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet):
+    def edit(self, name=None, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet, archived=github.GithubObject.NotSet):
         """
         :calls: `PATCH /repos/:owner/:repo <http://developer.github.com/v3/repos>`_
         :param name: string
@@ -1172,6 +1172,7 @@ def edit(self, name=None, description=github.GithubObject.NotSet, homepage=githu
         :param has_wiki: bool
         :param has_downloads: bool
         :param default_branch: string
+        :param archived: bool. Unarchiving repositories is currently not supported through API (https://developer.github.com/v3/repos/#edit)
         :rtype: None
         """
         if name is None:
@@ -1184,6 +1185,7 @@ def edit(self, name=None, description=github.GithubObject.NotSet, homepage=githu
         assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
         assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
         assert default_branch is github.GithubObject.NotSet or isinstance(default_branch, (str, unicode)), default_branch
+        assert archived is github.GithubObject.NotSet or (isinstance(archived, bool) and archived is True), archived
         post_parameters = {
             "name": name,
         }
@@ -1201,6 +1203,8 @@ def edit(self, name=None, description=github.GithubObject.NotSet, homepage=githu
             post_parameters["has_downloads"] = has_downloads
         if default_branch is not github.GithubObject.NotSet:
             post_parameters["default_branch"] = default_branch
+        if archived is not github.GithubObject.NotSet:
+            post_parameters["archived"] = archived 
         headers, data = self._requester.requestJsonAndCheck(
             "PATCH",
             self.url,


Test patch: