Skip to content

Commit f26827a

Browse files
authored
Merge pull request #183 from onuralpszr/invalid_api_key_check
fix: 🐛 check for rlogin is None
2 parents 46a2523 + 28c8593 commit f26827a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

roboflow/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ def login(workspace=None, force=False):
8787

8888
if os.path.isfile(conf_location) and not force:
8989
write_line(
90-
"You are already logged into Roboflow. To make a different login, run roboflow.login(force=True)."
90+
"You are already logged into Roboflow. To make a different login,"
91+
"run roboflow.login(force=True)."
9192
)
9293
return None
9394
# we could eventually return the workspace object here
@@ -114,6 +115,10 @@ def login(workspace=None, force=False):
114115

115116
if r_login.status_code == 200:
116117
r_login = r_login.json()
118+
if r_login is None:
119+
raise ValueError(
120+
"Invalid API key. " "Please check your API key and try again."
121+
)
117122

118123
# make config directory if it doesn't exist
119124
if not os.path.exists(os.path.dirname(conf_location)):

0 commit comments

Comments
 (0)