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

CustomVision - create_project throws AttributeError: 'str' object has no attribute 'signed_session' #11503

Closed
iMicknl opened this issue May 18, 2020 · 10 comments · Fixed by #11827 · May be fixed by Azure-Samples/cognitive-services-python-sdk-samples#89
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Cognitive - Custom Vision Service Attention Workflow: This issue is responsible by Azure service team.
Milestone

Comments

@iMicknl
Copy link
Member

iMicknl commented May 18, 2020

  • Package Name: Custom Vision
  • Package Version: 2.0.0
  • Operating System: Linux
  • Python Version: 3.6

Describe the bug
Creating a project via create_project does throw a AttributeError: 'str' object has no attribute 'signed_session'. This is solved when calling the CustomVisionTrainingClient with ApiKeyCredentials, however this is not documented as a breaking change on PyPi.

To Reproduce
Steps to reproduce the behavior:

from azure.cognitiveservices.vision.customvision.training import CustomVisionTrainingClient

ENDPOINT = "https://westeurope.api.cognitive.microsoft.com/" # your API endpoint
key = "" # Replace with a valid key

trainer = CustomVisionTrainingClient(credentials=key, endpoint=ENDPOINT)
project = trainer.create_project("FormRecognizerVisionClassification")

throws

AttributeError: 'str' object has no attribute 'signed_session

Additional context
It would be great if there were any samples updated after the 2.0.0 release. I did waste a lot of time by going through the SDK source files.

Outdated content:
https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/quickstarts/image-classification?pivots=programming-language-python

https://github.com/Azure-Samples/cognitive-services-python-sdk-samples/tree/master/samples/vision

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label May 18, 2020
@kaerm kaerm added Client This issue points to a problem in the data-plane of the library. Cognitive Services Service Attention Workflow: This issue is responsible by Azure service team. labels May 18, 2020
@ghost
Copy link

ghost commented May 18, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dfulcer.

@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label May 18, 2020
@kaerm kaerm added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label May 18, 2020
@lmazuel
Copy link
Member

lmazuel commented May 21, 2020

Hi @iMicknl
I agree documentation should be updated. That being said, what you described is not a breaking change, this SDK required since day 1 ApiKeyCredentials as credentials type (we can see it already in the outdated samples you mention).

Could you rename your issue to be more accurate, about updating samples and documentations?

Thanks!

@iMicknl
Copy link
Member Author

iMicknl commented May 25, 2020

@lmazuel Thanks! I am not sure if I fully understand what you mean. The ApiKeyCredentials is not mentioned in the two samples I mention, I have added the specific samples below again.

Does this mean that both examples are not using the correct approach? Or is this a breaking change after all? :-)

MicrosoftDocs/azure-docs@c26516c#diff-312534b6d704c284180ce766e44e90a9

https://github.com/Azure-Samples/cognitive-services-python-sdk-samples/blob/master/samples/vision/custom_vision_training_samples.py

@lmazuel
Copy link
Member

lmazuel commented May 27, 2020

@areddish I'm confused here how you got a sample working before by just passing a string, autorest would never have supported that? Was it manually written?

Edit: Ok, I see the parameter was described as a generic header in the Swagger. That helps connect the dot :)

@lmazuel lmazuel added this to the Backlog milestone May 27, 2020
@lmazuel
Copy link
Member

lmazuel commented May 27, 2020

@iMicknl I get what happen now, sorry for my initial answer. There is a pattern to follow that custom vision was not following, and ApiKeyCredentials is the correct way to go.

I assign this issue to @areddish who will handle the samples as necessary, thanks for the report!

@areddish
Copy link

@lamazuel Yes, this release aligns us with the other SDK's using ApiKeyCredentials. I've updated the documentation, but looks like I missed a sample. Will do that now.

@iMicknl
Copy link
Member Author

iMicknl commented May 27, 2020

Thanks @lmazuel & @areddish! Great that all SDK's are aligned now, makes sense :).

Would it be wise to note this as a breaking change on PyPi? This will help users of the <2.0.0 package. Especially since other (faulty) breaking changes are mentioned there, which is confusing. (#11504)

@lmazuel
Copy link
Member

lmazuel commented Jun 4, 2020

@iMicknl does #11827 look ok?

@iMicknl
Copy link
Member Author

iMicknl commented Jun 4, 2020

@lmazuel looks good to me!

@jbulow
Copy link

jbulow commented Sep 20, 2020

This is still an issue. Why was it closed?

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Cognitive - Custom Vision Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
5 participants