Azure / Azure/azure-functions-core-tools
Python Azure Function expecting System.Net.Http.Formatting
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 498
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 14
Description
I have a Python Azure Function (V2 model) and work with Visual Studio Code, using Python 3.9 as an interpreter, also have 3.12 installed, but FA starts only with the Python 3.9 version.
While running the command - **func host start**
the function app almost starts but I get the following error -
A host error has occurred during startup operation 'e832c327-df1a-464b-9045-e85072afd857'.
Microsoft.Azure.WebJobs.Extensions.Http: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Value cannot be null. (Parameter 'provider')
Not sure what am I missing, I have used "import requests" but still it doesn't seem to work.
Very straightforward code-
import logging
import azure.functions as func
app = func.FunctionApp()
@app.function_name(name="GetSettings")
@app.route(route="company/{Id}/Settings", methods=['GET'], auth_level=func.AuthLevel.FUNCTION)
def GetSettings(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
# Get ID from the route parameter
site_id = req.route_params.get('companyId')
logging.info(company_id)
Could someone suggest what am I missing?
Contributor guide
Research direction
Start by reproducing the failure with `func host start` in the Python 3.9 environment described, comparing it with the installed Python 3.12 setup. No repository files or tests are identified; done means determining why the host cannot load `System.Net.Http.Formatting` and confirming that the function app starts without the reported host error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100