-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from crunchdao/dev
2.3.0
- Loading branch information
Showing
7 changed files
with
137 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
__title__ = 'crunch-cli' | ||
__description__ = 'crunch-cli - CLI of the CrunchDAO Platform' | ||
__version__ = '2.2.0' | ||
__version__ = '2.3.0' | ||
__author__ = 'Enzo CACERES' | ||
__author_email__ = '[email protected]' | ||
__url__ = 'https://github.com/crunchdao/crunch-cli' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
from .push import push | ||
from .setup import setup | ||
from .test import test | ||
from .update_token import update_token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import click | ||
|
||
from .. import api, utils | ||
|
||
|
||
def update_token( | ||
session: utils.CustomSession, | ||
clone_token: str, | ||
): | ||
project_info = utils.read_project_info() | ||
|
||
try: | ||
push_token = session.post( | ||
f"/v2/project-tokens/upgrade", | ||
json={ | ||
"cloneToken": clone_token | ||
} | ||
).json() | ||
except api.InvalidProjectTokenException: | ||
print("your token seems to have expired or is invalid") | ||
print("---") | ||
print("please follow this link to copy and paste your new token:") | ||
print(session.format_web_url( | ||
f'/competitions/{project_info.competition_name}/submit' | ||
)) | ||
print("") | ||
|
||
raise click.Abort() | ||
|
||
plain = push_token['plain'] | ||
user_id = push_token['project']["userId"] | ||
|
||
project_info.user_id = user_id | ||
utils.write_project_info(project_info) | ||
utils.write_token(plain) | ||
|
||
print("token updated") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters