Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 check for rlogin is None #183

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

onuralpszr
Copy link
Contributor

Description

I notice that if I type random string or invalid key it was creating folder and AttributeError occured. I added check in the begin and if response is NONE, I added ValueError for prevent unneeded process and stop the login

List any dependencies that are required for this change.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How has this change been tested, please provide a testcase or example of how you tested the change?

Current Error

>>> import roboflow
>>> roboflow.login()
visit https://app.roboflow.com/auth-cli to get your authentication token.
Paste the authentication token here:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/onuralp/roboflow/roboflow-python/roboflow/__init__.py", line 126, in login
    default_workspace_id = list(r_login["workspaces"].keys())[0]
AttributeError: 'NoneType' object has no attribute 'keys'

Fixed Version (Controlled Error)

>>> import roboflow
>>> roboflow.login()
visit https://app.roboflow.com/auth-cli to get your authentication token.
Paste the authentication token here:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/onuralp/roboflow/roboflow-python/roboflow/__init__.py", line 118, in login
    raise ValueError("Invalid API key. "
ValueError: Invalid API key. Please check your API key and try again.

Copy link
Collaborator

@capjamesg capjamesg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should have an AuthenticationError class one day that represents different errors that can occur. That's just me brainstorming though! This looks good to me.

@capjamesg
Copy link
Collaborator

@onuralpszr Can you run your PR through black? The PR is failing the black test in our CI.

@capjamesg
Copy link
Collaborator

Thank you for fixing the linting issues! Will merge!

@capjamesg capjamesg merged commit f26827a into roboflow:main Sep 13, 2023
3 checks passed
@onuralpszr
Copy link
Contributor Author

@capjamesg yay thank you ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants