Skip to content

Commit 8319825

Browse files
author
Michael Barr
committed
Removed unused import HTTPError. Used collections.Iterable to determine if we are passed an iterable for steamids, or str() the steamid.
1 parent fb8b739 commit 8319825

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

steamwebapi/user.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# =============================================================================
44
# Python Imports
55
import re
6-
from requests import HTTPError
6+
from collections import Iterable
77

88
# API Imports
99
from .core import SteamWebAPI
@@ -44,10 +44,11 @@ def GetFriendList(self, steamid, relationship='all', method_version=1):
4444
@api_key_required
4545
def GetPlayerBans(self, steamids=[], method_version=1):
4646
""""""
47-
if isinstance(steamids, str):
48-
pass
49-
else:
47+
# If we are passed a non-string iterable, join steamids with ","
48+
if not isinstance(steamids, str) and isinstance(steamids, Iterable):
5049
",".join(steamids)
50+
else:
51+
steamids = str(steamids)
5152

5253
# Set up the parameters
5354
parameters = {
@@ -67,9 +68,8 @@ def GetPlayerBans(self, steamids=[], method_version=1):
6768
@api_key_required
6869
def GetPlayerSummaries(self, steamids=[], method_version=2):
6970
""""""
70-
if isinstance(steamids, str):
71-
pass
72-
elif isinstance(steamids, list):
71+
# If we are passed a non-string iterable, join steamids with ","
72+
if not isinstance(steamids, str) and isinstance(steamids, Iterable):
7373
",".join(steamids)
7474
else:
7575
steamids = str(steamids)

0 commit comments

Comments
 (0)