Skip to content

Issue in Python 3.11+ with setting base_url for GraphServiceClient #818

@peter-equinor

Description

@peter-equinor

I'm experiencing issues suddenly after updating to python 3.11, getting "Valid url scheme and host required" when trying to use the GraphServiceClient

I think I have narrowed it down to some strange handling of enums in graph_client_factory.py in _get_base_url in the f-string handling of enums

Running the following code:

from enum import Enum

class NationalClouds(str, Enum):
    Global = 'https://graph.microsoft.com'
    
    
print("print:", NationalClouds.Global)
print(f"f-string: {NationalClouds.Global}")

print("%%-formatting: %s" % NationalClouds.Global)

Yields

print: NationalClouds.Global
f-string: https://graph.microsoft.com
%-formatting: NationalClouds.Global

In 3.10 and earlier, but

print: NationalClouds.Global
f-string: NationalClouds.Global
%-formatting: NationalClouds.Global

So my base URL is being set to NationalClouds.Global/APIVersion.v1/

I don't feel confident in fixing this myself, but would like if anyone has any input on my issue.

Metadata

Metadata

Assignees

Labels

WIPbugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions