Skip to main content

get_endpoints

Preliminary / Supporting
  • After dragging it to the Endpoint, use Constructor Actually establish a session.
  • For cross-service discovery, please use find_servers.

Signature​

@staticmethod
def get_endpoints(endpoint_url: str,
timeout_ms: int = 10_000) -> List[EndpointDescription]: ...

Connect to the server using temporary SecureChannel (None mode), complete the sequence TCP → Hello/Ack → OPN(None) → GetEndpoints, and then CLO disconnect. No session required.

Corresponding section of the standard: OPC UA Part 4 §5.4.4 (GetEndpoints).

Parameters​

ParametersDefaultNote
endpoint_url—Target endpoint, such as "opc.tcp://server:4840"; an empty string results in an exception ValueError
timeout_ms10_000Timeout (milliseconds); when 0 is passed, treat it as 10 000 ms

Returns an empty list (without throwing an exception) if none of the servers have been published List[EndpointDescription].

EndpointDescription Field​

FieldTypeNote
endpoint_urlOptional[str]Actual endpoint URL
security_modeMessageSecurityModeNONE / Sign / SignAndEncrypt
security_policy_uriOptional[str]Algorithm Suite URI
server_application_uriOptional[str]Server Applications URI
server_product_uriOptional[str]Server Products URI
server_application_nameOptional[str]Server Application Name
server_application_typeint0=Server / 1=Client / 2=ClientAndServer / 3=DiscoveryServer
server_certificateOptional[bytes]Server Certificate (DER)
transport_profile_uriOptional[str]Transmission Profile (usually UA-TCP)
security_levelintServer-Side Recommendation Priority
user_tokensList[UserTokenPolicy]Supported Login Methods

UserTokenPolicy Field​

FieldTypeNote
policy_idOptional[str]The ID provided by the server, which is sent back when the client is activated
token_typeUserTokenTypeAnonymous / Username / Certificate / Issued

Usage​

from darra_opcua import OpcUaDiscovery

endpoints = OpcUaDiscovery.get_endpoints("opc.tcp://server:4840")

print(f"Server has {len(endpoints)} endpoints:")
for ep in endpoints:
print(f"\n URL: {ep.endpoint_url}")
print(f" Mode: {ep.security_mode.name}")
print(f" Policy: {ep.security_policy_uri}")
print(f" Tokens:")
for t in ep.user_tokens:
print(f" - {t.token_type.name} (policy_id={t.policy_id})")

Sample Output​

Server has 4 endpoints:

URL: opc.tcp://server:4840
Mode: NONE
Policy: http://opcfoundation.org/UA/SecurityPolicy#None
Tokens:
- Anonymous

URL: opc.tcp://server:4840
Mode: Sign
Policy: http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256
Tokens:
- Anonymous
- Username

URL: opc.tcp://server:4840
Mode: SignAndEncrypt
Policy: http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256
Tokens:
- Username
- Certificate

The server typically exposes multiple combinations (NONE / Sign / SignAndEncrypt × Anonymous / Username / Certificate), and the client selects the appropriate one based on its needs.

Exception​

Always throw an exception on failure OpcUaException; use type e.status_code casting (the value is an enum StatusCode; for codes not included in the enum, retain the original int).

Exceptionstatus_codeTrigger
ValueError("endpoint_url is required")—endpoint_url is empty
OpcUaExceptionBadCommunicationErrorUnable to connect to the server / Connection lost
OpcUaExceptionBadTimeouttimeout_ms No response was received internally
OpcUaExceptionBadEncodingError / BadDecodingErrorRequest encoding or response parsing failed
OpcUaExceptionThe serviceResult returned by the serverFor example, ( BadServiceUnsupported the server does not support Discovery), the original value is passed through

Implementation Constraints​

  • Synchronous, blocking call; the timeout is controlled timeout_ms by; The parameter was not removed
  • Returns a maximum of 256 records EndpointDescription; if the server returns more than that, only the first 256 records are retrieved, and no error is reported
  • No Session: The connection is terminated immediately after the request is completed; it does not consume server session quotas, nor does it require prior connect()

Cross-Language Comparison​

C#PythonJavaC++RustC
GetEndpointsget_endpointsgetEndpointsDiscovery::GetEndpointsDiscovery::get_endpointsDarraUa_Discovery_GetEndpoints

Next Step​