Skip to content

Commit

Permalink
error fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophie Fitzpatrick committed Feb 21, 2021
1 parent 5a97117 commit fb7e543
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
21 changes: 12 additions & 9 deletions marvelcli/project/project_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,18 @@ def get_personal_projects(auth: str):
"""List all projects owned by you"""
query = project_queries.get_all_personal_projects_query
r, json_data = utils.make_request(auth, query)
data = json_data['data']['user']['projects']['edges']

urls = []
for d in data:
url = d['node']['prototypeUrl']
urls.append(url)
if r.status_code != 200:
click.echo('\n' + 'Your personal projects could not be returned at this time."' + '\n')
else:
data = json_data['data']['user']['projects']['edges']
urls = []
for d in data:
url = d['node']['prototypeUrl']
urls.append(url)

project_count = len(json_data['data']['user']['projects']['edges'])
click.echo('\nYou have %s project(s)' % project_count)
project_count = len(json_data['data']['user']['projects']['edges'])
click.echo('\nYou have %s project(s)' % project_count)

for url in urls:
click.echo(url)
for url in urls:
click.echo(url)
8 changes: 4 additions & 4 deletions marvelcli/user/user_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ def about_user(auth: str):
query = user_queries.about_user_query
r, json_data = utils.make_request(auth, query)

user = json_data['data']['user']
last_active = user['lastActiveAt']
last_active = datetime.datetime(int(last_active[0:4]), int(last_active[5:7]), int(last_active[8:10]), 0, 0)

if r.status_code != 200:
click.echo("\nWe could not retrieve the data at this time, possibly due to a ratelimit. Try again in a few minutes\n")
else:
user = json_data['data']['user']
last_active = user['lastActiveAt']
last_active = datetime.datetime(int(last_active[0:4]), int(last_active[5:7]), int(last_active[8:10]), 0, 0)

click.echo(utils.colour.BOLD + '\nYour Account: \n' + utils.colour.END)
click.echo('Email: %s' % user['email'])
click.echo('Last Active: %s' % last_active)
Expand Down

0 comments on commit fb7e543

Please sign in to comment.