Pyro5.core — core Pyro logic

Multi purpose stuff used by both clients and servers (URI etc)

class Pyro5.core.URI(uri)

Pyro object URI (universal resource identifier). The uri format is like this: PYRO:objectid@location where location is one of:

  • hostname:port (tcp/ip socket on given port)

  • ./u:sockname (Unix domain socket on localhost)

There is also a ‘Magic format’ for simple name resolution using Name server:

PYRONAME:objectname[@location] (optional name server location, can also omit location port)

And one that looks up things in the name server by metadata:

PYROMETA:meta1,meta2,...[@location] (optional name server location, can also omit location port)

You can write the protocol in lowercase if you like (pyro:...) but it will automatically be converted to uppercase internally.

static isUnixsockLocation(location)

determine if a location string is for a Unix domain socket

property location

property containing the location string, for instance "servername.you.com:5555"

Pyro5.core.locate_ns(host: str | IPv4Address | IPv6Address = '', port: int | None = None, broadcast: bool = True) client.Proxy

Get a proxy for a name server somewhere in the network.

Pyro5.core.resolve(uri: str | URI, delay_time: float = 0.0) URI

Resolve a ‘magic’ uri (PYRONAME, PYROMETA) into the direct PYRO uri. It finds a name server, and use that to resolve a PYRONAME uri into the direct PYRO uri pointing to the named object. If uri is already a PYRO uri, it is returned unmodified. You can consider this a shortcut function so that you don’t have to locate and use a name server proxy yourself. Note: if you need to resolve more than a few names, consider using the name server directly instead of repeatedly calling this function, to avoid the name server lookup overhead from each call. You can set delay_time to the maximum number of seconds you are prepared to wait until a name registration becomes available in the nameserver.

Pyro5.core.type_meta(class_or_object, prefix='class:')

extracts type metadata from the given class or object, can be used as Name server metadata.