File: client.py

package info (click to toggle)
pyro5 5.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,124 kB
  • sloc: python: 14,328; makefile: 161; sh: 66; javascript: 62
file content (22 lines) | stat: -rw-r--r-- 662 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import random
from Pyro5.api import Proxy


uri = input("Enter the URI of the server object: ")

with Proxy(uri) as proxy:
    print("currently allocated resources:", proxy.list())
    name1 = hex(random.randint(0, 999999))[-4:]
    name2 = hex(random.randint(0, 999999))[-4:]
    print("allocating resource...", name1)
    proxy.allocate(name1)
    print("allocating resource...", name2)
    proxy.allocate(name2)
    input("\nhit Enter now to continue normally or ^C/break to abort the connection forcefully:")
    print("free resources normally...")
    proxy.free(name1)
    proxy.free(name2)
    print("allocated resources:", proxy.list())


print("done.")