pokerbots-dev 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/PKG-INFO +1 -1
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/pyproject.toml +1 -1
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/api.py +2 -2
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/commands/account.py +22 -5
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/docs.md +1 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/.gitignore +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/README.md +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/__init__.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/agent.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/auth.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/cards.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/commands/__init__.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/commands/admin.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/commands/local.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/commands/money.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/engine.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/fmt.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/house.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/main.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/template/bot.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/src/pokerbots_cli/wallet.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/tests/test_agent.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/tests/test_cards.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/tests/test_cli.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/tests/test_engine.py +0 -0
- {pokerbots_dev-0.1.0 → pokerbots_dev-0.1.2}/tests/test_wallet.py +0 -0
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import urllib.error
|
|
4
4
|
import urllib.request
|
|
5
5
|
|
|
6
|
-
from . import auth
|
|
6
|
+
from . import __version__, auth
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class ApiError(Exception):
|
|
@@ -15,7 +15,7 @@ def base():
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def call(method, path, body=None, data=None, headers=None):
|
|
18
|
-
headers =
|
|
18
|
+
headers = {"User-Agent": f"pb/{__version__}", **(headers or {})}
|
|
19
19
|
if "CF-Access-Client-Id" not in headers:
|
|
20
20
|
credentials = auth.load()
|
|
21
21
|
if not credentials:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import io
|
|
2
2
|
import sys
|
|
3
|
+
import time
|
|
3
4
|
import zipfile
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
|
|
@@ -8,6 +9,7 @@ from ..api import call
|
|
|
8
9
|
from ..fmt import money, place, table
|
|
9
10
|
|
|
10
11
|
MAX_UPLOAD = 1 << 20
|
|
12
|
+
WATCH_SECONDS = 5
|
|
11
13
|
ATTEST = "I am 18 or older, and paid skill competitions are allowed where I am. [y/N] "
|
|
12
14
|
|
|
13
15
|
|
|
@@ -54,20 +56,34 @@ def stop(args):
|
|
|
54
56
|
print(f"stopped {mode}")
|
|
55
57
|
|
|
56
58
|
|
|
57
|
-
def
|
|
59
|
+
def report():
|
|
58
60
|
me = call("GET", "/me")
|
|
59
61
|
rows = [["user", me["login"]], ["versions", " ".join(f"v{v}" for v in me["versions"]) or "-"]]
|
|
60
62
|
for mode in ("paper", "live"):
|
|
61
63
|
d = me["deployments"].get(mode)
|
|
62
64
|
rows.append([mode, f"v{d['version']} rating {d['rating']:.0f} games {d['games']} today {d['today']}" if d else "-"])
|
|
63
65
|
rows += [["balance", money(me["balance"])], ["wallet", me["wallet"] or "-"]]
|
|
64
|
-
|
|
66
|
+
text = table(rows)
|
|
65
67
|
games = call("GET", "/games")
|
|
66
68
|
if games:
|
|
67
|
-
|
|
68
|
-
print(table([["game", "mode", "place", "hands"]] + [
|
|
69
|
+
text += "\n\n" + table([["game", "mode", "place", "hands"]] + [
|
|
69
70
|
[g["created_at"], g["mode"], place(g["place"]), g["hands"] or "-"] for g in games
|
|
70
|
-
])
|
|
71
|
+
])
|
|
72
|
+
return text
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def status(args):
|
|
76
|
+
print(report())
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def watch(args):
|
|
80
|
+
try:
|
|
81
|
+
while True:
|
|
82
|
+
sys.stdout.write("\x1b[H\x1b[2J" + report() + "\n\nctrl-c to quit\n")
|
|
83
|
+
sys.stdout.flush()
|
|
84
|
+
time.sleep(WATCH_SECONDS)
|
|
85
|
+
except KeyboardInterrupt:
|
|
86
|
+
pass
|
|
71
87
|
|
|
72
88
|
|
|
73
89
|
def register(sub):
|
|
@@ -87,3 +103,4 @@ def register(sub):
|
|
|
87
103
|
p.set_defaults(run=run)
|
|
88
104
|
|
|
89
105
|
sub.add_parser("status", help="your bot, rating, balance and recent games").set_defaults(run=status)
|
|
106
|
+
sub.add_parser("watch", help="status, live").set_defaults(run=watch)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|