Skip to content

Commit 2a10735

Browse files
authored
Merge pull request #156 from HADB/upstream
Update new Battle.net profile url
2 parents e7f8ade + 6bb984d commit 2a10735

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

docs/source/tutorials/prettyprinter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Many of the replay attributes are nested data structures which are generally all
8989
>>> replay.teams[0].players[0].color.hex
9090
'B4141E'
9191
>>> replay.player.name('Remedy').url
92-
'http://us.battle.net/sc2/en/profile/2198663/1/Remedy/'
92+
'https://starcraft2.com/en-us/profile/1/1/2198663'
9393

9494
Each of these nested structures can be found either on its own reference page or lumped together with the other minor structures on the Misc Structures page.
9595

sc2reader/objects.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ def __init__(self, pid, slot_data, detail_data, attribute_data):
241241
#: The Battle.net region the entity is registered to
242242
self.region = GATEWAY_LOOKUP[detail_data["bnet"]["region"]]
243243

244+
#: The Battle.net region id the entity is registered to
245+
self.region_id = detail_data["bnet"]["region"]
246+
244247
#: The Battle.net subregion the entity is registered to
245248
self.subregion = detail_data["bnet"]["subregion"]
246249

@@ -258,7 +261,7 @@ class User(object):
258261

259262
#: The Battle.net profile url template
260263
URL_TEMPLATE = (
261-
"http://{region}.battle.net/sc2/en/profile/{toon_id}/{subregion}/{name}/"
264+
"https://starcraft2.com/en-us/profile/{region_id}/{subregion}/{toon_id}"
262265
)
263266

264267
def __init__(self, uid, init_data):

test_replays/test_replays.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,8 @@ def test_standard_1v1(self):
7979
self.assertEqual(emperor.result, "Win")
8080
self.assertEqual(boom.result, "Loss")
8181

82-
self.assertEqual(
83-
emperor.url, "http://eu.battle.net/sc2/en/profile/520049/1/Emperor/"
84-
)
85-
self.assertEqual(
86-
boom.url, "http://eu.battle.net/sc2/en/profile/1694745/1/Boom/"
87-
)
82+
self.assertEqual(emperor.url, "https://starcraft2.com/en-us/profile/2/1/520049")
83+
self.assertEqual(boom.url, "https://starcraft2.com/en-us/profile/2/1/1694745")
8884

8985
self.assertEqual(len(replay.messages), 12)
9086
self.assertEqual(replay.messages[0].text, "hf")
@@ -163,10 +159,10 @@ def test_us_realm(self):
163159
reddawn = [player for player in replay.players if player.name == "reddawn"][0]
164160
self.assertEqual(
165161
shadesofgray.url,
166-
"http://us.battle.net/sc2/en/profile/2358439/1/ShadesofGray/",
162+
"https://starcraft2.com/en-us/profile/1/1/2358439",
167163
)
168164
self.assertEqual(
169-
reddawn.url, "http://us.battle.net/sc2/en/profile/2198663/1/reddawn/"
165+
reddawn.url, "https://starcraft2.com/en-us/profile/1/1/2198663"
170166
)
171167

172168
def test_kr_realm_and_tampered_messages(self):
@@ -178,12 +174,8 @@ def test_kr_realm_and_tampered_messages(self):
178174
self.assertEqual(replay.expansion, "WoL")
179175
first = [player for player in replay.players if player.name == "명지대학교"][0]
180176
second = [player for player in replay.players if player.name == "티에스엘사기수"][0]
181-
self.assertEqual(
182-
first.url, "http://kr.battle.net/sc2/en/profile/258945/1/명지대학교/"
183-
)
184-
self.assertEqual(
185-
second.url, "http://kr.battle.net/sc2/en/profile/102472/1/티에스엘사기수/"
186-
)
177+
self.assertEqual(first.url, "https://starcraft2.com/en-us/profile/3/1/258945")
178+
self.assertEqual(second.url, "https://starcraft2.com/en-us/profile/3/1/102472")
187179
self.assertEqual(replay.messages[0].text, "sc2.replays.net")
188180
self.assertEqual(replay.messages[5].text, "sc2.replays.net")
189181

0 commit comments

Comments
 (0)