Skip to content

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

Description

  • 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

Activity

  1. ghost added
    needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.
    on May 18, 2020
  2. ghost removed
    needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.
    on May 18, 2020
  3. added
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    on May 18, 2020
  4. lmazuel commented on May 21, 2020

    @lmazuel
    Member

    Hi Mick Vleeshouwer (@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!

  5. iMicknl commented on May 25, 2020

    @iMicknl
    Author

    Laurent Mazuel (@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

  6. lmazuel commented on May 27, 2020

    @lmazuel
    Member

    Andrew (@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 :)

  7. lmazuel commented on May 27, 2020

    @lmazuel
    Member

    Mick Vleeshouwer (@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 Andrew (@areddish) who will handle the samples as necessary, thanks for the report!

  8. areddish commented on May 27, 2020

    @areddish

    @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.

  9. iMicknl commented on May 27, 2020

    @iMicknl
    Author

    Thanks Laurent Mazuel (@lmazuel) & Andrew (@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)

  10. lmazuel commented on Jun 4, 2020

    @lmazuel
    Member
  11. iMicknl commented on Jun 4, 2020

    @iMicknl
    Author

    Laurent Mazuel (@lmazuel) looks good to me!

  12. jbulow commented on Sep 20, 2020

    @jbulow

    This is still an issue. Why was it closed?

  13. locked and limited conversation to collaborators on Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.Cognitive - Custom VisionService AttentionWorkflow: This issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions