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
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dfulcer.
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!
@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? :-)
https://github.com/MicrosoftDocs/azure-docs/commit/c26516ce1e42e2a7a6d0fb151cf31c8ccefcaf17#diff-312534b6d704c284180ce766e44e90a9
@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 :)
@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!
@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.
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. (https://github.com/Azure/azure-sdk-for-python/issues/11504)
@iMicknl does #11827 look ok?
@lmazuel looks good to me!
This is still an issue. Why was it closed?