It sounds like you want to get the response of the Host API admin/host/keys
of Azure Functions as below, so please refer to Azure Functions wiki page Key management API

Here is my sample code.
# App Credentials, to get it see the figures below
username = "<your username like `$xxxxx`>"
password = "<your password>"
functionapp_name = "<your function app name>"
api_url = f"https://{functionapp_name}.scm.azurewebsites.net/api"
site_url = f"https://{functionapp_name}.azurewebsites.net"
import base64
import requests
auth_info = f"{username}:{password}"
base64_auth = base64.b64encode(str.encode(auth_info)).decode()
print(base64_auth)
jwt_resp = requests.get(f"{api_url}/functions/admin/token", headers={"Authorization": f"Basic {base64_auth}"})
jwt = jwt_resp.text.replace("\"", "", -1)
print(jwt)
keys_resp = requests.get(f"{site_url}/admin/host/keys", headers={"Authorization": f"Bearer {jwt}"})
print(keys_resp.text)
It works and its result as below.

For getting the username and password of App Credentials, please see the figures below.
Fig 1. On Azure portal, open the Platform features
tab of your Function App and click the Deployment Center
link

Fig 2. Select the FTP
option in the first step of SOURCE CONTROL
and click the Dashboard
button to copy the values of Username
and Password
, but just use the part of Username
with $
prefix as username
variable in my script. Ofcouse, you also can use them in tab User Credentials
tab.

Also, you can refer to my answer for the similar SO thread Unable to access admin URL of Azure Functions using PowerShell, and my figures below come from that.
Update: For using Azure Function for Python in container, please refer to the figure below to get the deployment credentials.
