When trying to import a GitHub repository to Pagure, if the GitHub account has 2FA set up, the import will fail.
The importer should query to see if the user has 2FA set up, and if so, request the OTP code from the user. Right now, the error received if you try to run this is as follows.
$ pgimport github Enter you Github Username: jflory7 Enter your github password: Enter github project name like: "pypingou/pagure" without quotes: decause/feedcloud Do you want to generate jsons for project's contributers and issue commentors? (y/n): y Traceback (most recent call last): File "/usr/bin/pgimport", line 9, in <module> load_entry_point('pagure-importer==1.1.0', 'console_scripts', 'pgimport')() File "/usr/lib/python2.7/site-packages/click/core.py", line 716, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python2.7/site-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python2.7/site-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python2.7/site-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python2.7/site-packages/click/core.py", line 534, in invoke return callback(*args, **kwargs) File "/usr/lib/python2.7/site-packages/pagure_importer-1.1.0-py2.7.egg/pagure_importer/commands/github.py", line 43, in github github_project_name) File "/usr/lib/python2.7/site-packages/pagure_importer-1.1.0-py2.7.egg/pagure_importer/utils/__init__.py", line 38, in generate_json_for_github_contributors commits_url = project.commits_url.replace('{/sha}', '') File "/usr/lib/python2.7/site-packages/github/Repository.py", line 144, in commits_url self._completeIfNotSet(self._commits_url) File "/usr/lib/python2.7/site-packages/github/GithubObject.py", line 229, in _completeIfNotSet self._completeIfNeeded() File "/usr/lib/python2.7/site-packages/github/GithubObject.py", line 233, in _completeIfNeeded self.__complete() File "/usr/lib/python2.7/site-packages/github/GithubObject.py", line 238, in __complete self._url.value File "/usr/lib/python2.7/site-packages/github/Requester.py", line 172, in requestJsonAndCheck return self.__check(*self.requestJson(verb, url, parameters, headers, input, cnx)) File "/usr/lib/python2.7/site-packages/github/Requester.py", line 180, in __check raise self.__createException(status, responseHeaders, output) github.GithubException.TwoFactorException: 401 {u'documentation_url': u'https://developer.github.com/v3/auth#working-with-two-factor-authentication', u'message': u'Must specify two-factor authentication OTP code.'}
Fixed by #45
@cverna changed the status to Fixed
Fixed
Login to comment on this ticket.