|
13 | 13 | class GitbucketService(GithubService):
|
14 | 14 | fqdn = "localhost"
|
15 | 15 | port = 8080
|
| 16 | + |
16 | 17 | def __init__(self, *args, **kwarg):
|
17 | 18 | super(GitbucketService, self).__init__(*args, **kwarg)
|
18 | 19 |
|
19 | 20 | @classmethod
|
20 | 21 | def get_auth_token(cls, login, password, prompt=None):
|
21 |
| - print("Please open the following URL: https://yourgitbucket/youraccount/_application") |
| 22 | + print("Please open the following URL: {}/{}/_application".format(cls.build_url(cls), login)) |
22 | 23 | print("Generate a new token, and paste it at the following prompt.")
|
23 | 24 | return prompt('token> ')
|
24 |
| - ## this code maybe works when GitBucket supports add access token API. |
25 |
| - #print("build_url: ", cls.build_url(cls)) |
26 |
| - #import platform |
27 |
| - #gh = github3.GitHubEnterprise(cls.build_url(cls)) |
28 |
| - #gh.login(login, password, two_factor_callback=lambda: prompt('2FA code> ')) |
29 |
| - #try: |
30 |
| - # auth = gh.authorize(login, password, |
31 |
| - # scopes=[ 'repo', 'delete_repo', 'gist' ], |
32 |
| - # note='git-repo2 token used on {}'.format(platform.node()), |
33 |
| - # note_url='https://github.com/guyzmo/git-repo') |
34 |
| - # return auth.token |
35 |
| - #except github3.models.GitHubError as err: |
36 |
| - # if len(err.args) > 0 and 422 == err.args[0].status_code: |
37 |
| - # raise ResourceExistsError("A token already exist for this machine on your github account.") |
38 |
| - # else: |
39 |
| - # raise err |
40 | 25 |
|
41 | 26 | def format_path(self, repository, namespace=None, rw=False):
|
42 | 27 | repo = repository
|
|
0 commit comments