@@ -135,7 +135,7 @@ def __parse_as_key_values(self, br: BinaryReader, is_status=False):
135
135
return kv
136
136
137
137
def __parse_as_object (self , br : BinaryReader , is_player = False ):
138
- items , keyhashes , filters = [] , [], []
138
+ items , keyhashes , filters = {} , [], []
139
139
140
140
while br .length () > 0 :
141
141
# Get the key, for example player_1, frags_1, ping_1, etc...
@@ -163,15 +163,15 @@ def __parse_as_object(self, br: BinaryReader, is_player=False):
163
163
else :
164
164
keyhashes .append (value )
165
165
166
- # Append a dict to items if next index appears
167
- if len ( items ) <= index :
168
- items . append ({})
166
+ # Create a dict on items if next index appears
167
+ if index not in items :
168
+ items [ index ] = {}
169
169
170
170
# Save
171
171
items [index ][name ] = value
172
172
173
173
# Filter items by filters
174
- return [item for i , item in enumerate ( items ) if i not in filters ]
174
+ return [v for k , v in items . items ( ) if k not in filters ]
175
175
176
176
177
177
if __name__ == '__main__' :
@@ -182,6 +182,7 @@ async def main_async():
182
182
gs1 = GameSpy1 (address = '51.81.48.224' , query_port = 23000 , timeout = 5.0 ) # bfield1942
183
183
#gs1 = GameSpy1(address='139.162.235.20', query_port=7778, timeout=5.0) # ut
184
184
#gs1 = GameSpy1(address='192.223.24.6', query_port=7778, timeout=5.0) # ut
185
+ gs1 = GameSpy1 (address = '141.94.205.35' , query_port = 12300 , timeout = 5.0 ) # mohaa
185
186
status = await gs1 .get_status ()
186
187
print (json .dumps (status , indent = None ) + '\n ' )
187
188
0 commit comments