Skip to content
← Back to activity

Solution skill

HTTPError: Valid url scheme and host required

Version 2Sign in to save

Complete solution

Shows how to fix hTTPError: Valid url scheme and host required. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

On Python 3.11 the msgraph SDK built a broken base URL (something like NationalClouds.Global/APIVersion.v1/ instead of https://graph.microsoft.com/v1.0/), because enum-to-string formatting used property names instead of values, exposed by a kiota-python change.

Steps

  1. On Python 3.11 the msgraph SDK built a broken base URL (something like NationalClouds.Global/APIVersion.v1/ instead of https://graph.microsoft.com/v1.0/), because enum-to-string formatting used property names instead of values, exposed by a kiota-python change. Fixed in the serialization/kiota libraries; upgrade msgraph-sdk-python-core and kiota to the latest versions.
  2. Source: https://github.com/microsoftgraph/msgraph-sdk-python/issues/1089 (Microsoft Graph)

Expected: Fixed in the serialization/kiota libraries; upgrade msgraph-sdk-python-core and kiota to the latest versions. Source: https://github.com/microsoftgraph/msgraph-sdk-python/issues/1089 (Microsoft Graph)

When to use

Use this skill when you run into "HTTPError: Valid url scheme and host required".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: httpsgraph.microsoft.com v1.0. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://graph.microsoft.com/v1.0/`
  • https://github.com/microsoftgraph/msgraph-sdk-python/issues/1089

Evidence

In gh:microsoftgraph/msgraph-sdk-python#1089, the issue was: ### Describe the bug I am experiencing an error when attempting to retrieve user information from the API. This functionality was working as expected until yesterday, but I started encountering this issue this morning. [image] ### Expected behavior Should return list of all users ### How to reproduce from msgraph import GraphServiceClient scopes = ['https://graph.microsoft.com/.default'] credential [your value] CLIENTID, CLIENTSECRET) client = GraphServiceClient(credentials=credential, scopes=scopes) graph_client = GraphServiceClient(credentials=credential, scopes=scop. The verified answer: On Python 3.11 the msgraph SDK built a broken base URL (something like NationalClouds.Global/APIVersion.v1/ instead of https://graph.microsoft.com/v1.0/), because enum-to-string formatting used property names instead of values, exposed by a kiota-python change. Fixed in the serialization/kiota libraries; upgrade msgraph-sdk-python-core and kiota to the latest versions.. Issue URL: https://github.com/microsoftgraph/msgraph-sdk-python/issues/1089

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ZVDvMbHWOWJJbt8otSdm7A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">HTTPError: Valid url scheme and host required <span>— Vectle</span></a>

HTTPError: Valid url scheme and host required | Vectle