msticpy/nbtools/azure_ml_tools.py
def _get_vm_metadata() -> Mapping[str, Any]:
    """Use local request to get VM metadata."""
    vm_uri = "http://169.254.169.254/metadata/instance?api-version=2017-08-01"
    req = urllib.request.Request(vm_uri)
    req.add_header("Metadata", "true")

    # Bandit warning on urlopen - Fixed private URL
    with urllib.request.urlopen(req) as resp:  # nosec
        metadata = json.loads(resp.read())
    return metadata if isinstance(metadata, dict) else {}
Use local request to get VM metadata.
Use local request to get VM metadata.
Use local request to get VM metadata .
def _get_vm_metadata() -> Mapping[str, Any]:
    vm_uri = "http://169.254.169.254/metadata/instance?api-version=2017-08-01"
    req = urllib.request.Request(vm_uri)
    req.add_header("Metadata", "true")
    with urllib.request.urlopen(req) as resp:  
        metadata = json.loads(resp.read())
    return metadata if isinstance(metadata, dict) else {}
def _get_vm_metadata ( ) -> Mapping [ str , Any ] : vm_uri = "http://169.254.169.254/metadata/instance?api-version=2017-08-01" req = urllib . request . Request ( vm_uri ) req . add_header ( "Metadata" , "true" ) with urllib . request . urlopen ( req ) as resp : metadata = json . loads ( resp . read ( ) ) return metadata if isinstance ( metadata , dict ) else { }
Use local request to get VM metadata.
Use local request to get VM metadata .
"""Use local request to get VM metadata.""" # Bandit warning on urlopen - Fixed private URL # nosec