Skip to content

Commit 1fc110e

Browse files
committed
Rename get_server_response to _post, make it private
1 parent 733a9da commit 1fc110e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

bna/http.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, msg, response):
1818
super().__init__(msg)
1919

2020

21-
def get_server_response(data: Optional[str], host: str, path: str) -> bytes:
21+
def _post(host: str, path: str, *, data: Optional[str] = None) -> bytes:
2222
"""
2323
Send computed data to Blizzard servers
2424
Return the answer from the server
@@ -38,7 +38,7 @@ def get_server_response(data: Optional[str], host: str, path: str) -> bytes:
3838
def enroll(
3939
data: str, host: str = ENROLL_HOSTS["default"], path: str = PATHS["enroll"]
4040
) -> bytes:
41-
return get_server_response(data, host, path)
41+
return _post(host, path, data=data)
4242

4343

4444
def request_new_serial(
@@ -83,7 +83,7 @@ def get_time_offset(region: str = "US", path: str = PATHS["time"]) -> int:
8383
server clock.
8484
"""
8585
host = ENROLL_HOSTS.get(region, ENROLL_HOSTS["default"])
86-
response = get_server_response(None, host, path)
86+
response = _post(host, path)
8787
t = time()
8888

8989
# NOTE: The server returns time in milliseconds as an int whereas
@@ -117,14 +117,14 @@ def restore(serial: str, restore_code: str) -> str:
117117
def initiate_paper_restore(
118118
serial: str, host: str = ENROLL_HOSTS["default"], path: str = PATHS["init_restore"]
119119
) -> bytes:
120-
return get_server_response(serial, host, path)
120+
return _post(host, path, data=serial)
121121

122122

123123
def validate_paper_restore(
124124
data: str, host: str = ENROLL_HOSTS["default"], path: str = PATHS["validate_restore"]
125125
) -> bytes:
126126
try:
127-
response = get_server_response(data, host, path)
127+
response = _post(host, path, data=data)
128128
except HTTPError as e:
129129
if e.response.status == 600:
130130
raise HTTPError("Invalid serial or restore key", e.response)

0 commit comments

Comments
 (0)