Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix status error #5

Merged
merged 6 commits into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions battlemetrics.py
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ async def check_api_scopes(self, token: str = None) -> dict:
data = {
"token": token
}
return await self.helpers._make_request(method="POST", url=url, data=data)
return await self.helpers._make_request(method="POST", url=url, json=data)

async def pagination(self, page_link:str) -> dict:
return await self.helpers._make_request(method="GET", url=page_link)
@@ -86,7 +86,7 @@ async def metrics(self, name: str = "games.rust.players", start_date: str = None
"metrics[0][resolution]": resolution,
"fields[dataPoint]": "name,group,timestamp,value"
}
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def activity_logs(self, filter_bmid: int = None, filter_search: str = None, filter_servers: int = None, blacklist: str = None, whitelist: str = None) -> dict:
"""Retrieves the activity logs.
@@ -119,4 +119,4 @@ async def activity_logs(self, filter_bmid: int = None, filter_search: str = None
if filter_bmid:
data['filter[players]'] = filter_bmid

return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)
31 changes: 16 additions & 15 deletions components/banlist.py
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ async def create_invite(self, organization_id: int, banlist_id: str, permManage:
}
}
}
return await self.helpers._make_request(method="POST", url=url, data=data)
return await self.helpers._make_request(method="POST", url=url, json=data)

async def read_invitation(self, invite_id: str) -> dict:
"""Allows you to see the information about a specific banlist invite, such as uses.
@@ -64,7 +64,7 @@ async def read_invitation(self, invite_id: str) -> dict:
"fields[banList]": "name, action",
"fields[banListInvite]": "uses"
}
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def invite_list(self, banlist_id: str) -> dict:
"""Returns all the invites for a specific banlist ID
@@ -82,7 +82,7 @@ async def invite_list(self, banlist_id: str) -> dict:
"fields[banListInvite]": "uses",
"page[size]": "100"
}
return await self.helpers. _make_request(method="GET", url=url, data=data)
return await self.helpers. _make_request(method="GET", url=url, params=data)

async def delete_invite(self, banlist_id: str, banlist_invite_id: str) -> dict:
"""Deletes an invite from a targeted banlist
@@ -125,7 +125,7 @@ async def exemption_create(self, banid: str, organization_id: int, reason: str =
}
}
}
return await self.helpers._make_request(method="POST", url=url, data=data)
return await self.helpers._make_request(method="POST", url=url, json=data)

async def exemption_delete(self, banid: str) -> dict:
"""Deletes an exemption
@@ -165,7 +165,7 @@ async def exemption_info_all(self, banid: str) -> dict:
data = {
"fields[banExemption]": "reason"
}
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def exemption_update(self, banid: str, exemptionid: str, reason: str) -> dict:
"""Updates a ban exemption
@@ -181,7 +181,7 @@ async def exemption_update(self, banid: str, exemptionid: str, reason: str) -> d
banexemption = await self.exemption_info_single(banid=banid, exemptionid=exemptionid)
banexemption['data']['attributes']['reason'] = reason
url = f"{self.BASE_URL}/bans/{banid}/relationships/exemptions"
return await self.helpers._make_request(method="PATCH", url=url, data=banexemption)
return await self.helpers._make_request(method="PATCH", url=url, json=banexemption)

async def create(self, organization_id: int, action: str, autoadd: bool, ban_identifiers: list, native_ban: bool, list_default_reasons: list, ban_list_name: str) -> dict:
"""Creates a new banlist for your targeted organization.
@@ -229,7 +229,7 @@ async def create(self, organization_id: int, action: str, autoadd: bool, ban_ide
}
}
}
return await self.helpers._make_request(method="POST", url=url, data=data)
return await self.helpers._make_request(method="POST", url=url, json=data)

async def accept_invite(self, code: str, action: str, autoadd: bool, ban_identifiers: list, native_ban: bool, list_default_reasons: list, organization_id: str, organization_owner_id: str) -> dict:
"""Accepts an invitation to subscribe to a banlist.
@@ -278,7 +278,7 @@ async def accept_invite(self, code: str, action: str, autoadd: bool, ban_identif
}
}
}
return await self.helpers._make_request(method="POST", url=url, data=data)
return await self.helpers._make_request(method="POST", url=url, json=data)

async def unsubscribe(self, banlist_id: str, organization_id: str) -> dict:
"""Unscubscribes from a banlist
@@ -305,7 +305,7 @@ async def list(self) -> dict:
"include": "server,organization,owner",
"page[size]": "100"
}
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def subscribed_orgs(self, banlist_id: str) -> dict:
"""Lists all the organizations that are subscribed to the targeted banlist. You require manage perms to use this list (or be the owner)
@@ -321,7 +321,7 @@ async def subscribed_orgs(self, banlist_id: str) -> dict:
"include": "server,organization,owner",
"page[size]": "100"
}
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def subscribers(self, banlist_id: str, organization_id: str) -> dict:
"""Gets the subscriber information for a specific banlist.
@@ -338,7 +338,7 @@ async def subscribers(self, banlist_id: str, organization_id: str) -> dict:
data = {
"include": "organization, owner, server"
}
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def read(self, banlist_id: str) -> dict:
"""Retrieves the name of a banlist by the banlist id
@@ -353,7 +353,7 @@ async def read(self, banlist_id: str) -> dict:
data = {
"include": "owner"
}
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def update(self, banlist_id: str, organization_id: str, action: str = None, autoadd: bool = None, ban_identifiers: list = None, native_ban: bool = None, list_default_reasons: list = None, ban_list_name: str = None) -> dict:
"""Updates the targeted banlist with the altered information you supply
@@ -390,7 +390,7 @@ async def update(self, banlist_id: str, organization_id: str, action: str = None
if ban_list_name:
banlist['attributes']['name'] = ban_list_name
url = f"{self.BASE_URL}/ban-lists/{banlist_id}/relationships/organizations/{organization_id}"
return await self.helpers._make_request(method="PATCH", url=url, data=banlist)
return await self.helpers._make_request(method="PATCH", url=url, json=banlist)

async def get_list(self, banlist_id: str = None) -> dict:
"""Returns the banlist information of the targeted banlist
@@ -406,8 +406,9 @@ async def get_list(self, banlist_id: str = None) -> dict:
"page[size]": "100",
"include": "organization,owner,server"
}
banlists = await self.helpers._make_request(method="GET", url=url, data=data)
for banlist in banlists['data']:
banlists = await self.helpers._make_request(method="GET", url=url, params=data)
for banlist in banlists:
if banlist['id'] == banlist_id:
return banlist
return banlists

6 changes: 3 additions & 3 deletions components/bans.py
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ async def update(self, banid: str, reason: str = None, note: str = None, append:
ban['data']['attributes']['note'] += f"\n{note}"
else:
ban['data']['attributes']['note'] = note
return await self.helpers._make_request(method="PATCH", url=url, data=ban)
return await self.helpers._make_request(method="PATCH", url=url, json=ban)

async def search(self, search: str = None, player_id: int = None, banlist: str = None, expired: bool = True, exempt: bool = False, server: int = None, organization_id: int = None, userIDs: str = None):
"""List, search and filter existing bans.
@@ -98,7 +98,7 @@ async def search(self, search: str = None, player_id: int = None, banlist: str =
data['filter[users]'] = userIDs
url = f"{self.BASE_URL}/bans"

return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)


async def native_ban_info(self, server: int = None, ban: str = None) -> dict:
@@ -124,7 +124,7 @@ async def native_ban_info(self, server: int = None, ban: str = None) -> dict:
if server:
data["filter[server]"] = server
url = f"{self.BASE_URL}/bans-native"
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def native_force_update(self, native_id: str) -> dict:
"""Forces an update on a native ban
6 changes: 3 additions & 3 deletions components/flags.py
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ async def create(self, color: str, description: str, icon_name: str, flag_name:
}
}
}
return await self.helpers._make_request(method="POST", url=url, data=data)
return await self.helpers._make_request(method="POST", url=url, json=data)

async def delete(self, flag_id: str) -> dict:
"""Delete an existing flag.
@@ -89,7 +89,7 @@ async def list(self, filter_personal: bool = False) -> dict:
}
if filter_personal:
data["filter[personal]"] = str(filter_personal).lower()
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def update(self, flag_id: str, color: str, description: str, icon_name: str, flag_name: str) -> dict:
"""Create a new flag
@@ -116,4 +116,4 @@ async def update(self, flag_id: str, color: str, description: str, icon_name: st
}
}
}
return await self.helpers._make_request(method="PATCH", url=url, data=data)
return await self.helpers._make_request(method="PATCH", url=url, json=data)
8 changes: 4 additions & 4 deletions components/game_info.py
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ async def features(self, game: str = None) -> dict:
if game:
data['filter[game]'] = game
url = f"{self.BASE_URL}/game-features"
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def feature_options(self, feature_id: str, sort: str = "players") -> dict:
"""Gets the game feature options.
@@ -39,7 +39,7 @@ async def feature_options(self, feature_id: str, sort: str = "players") -> dict:
"sort": sort
}
url = f"{self.BASE_URL}/game-features/{feature_id}/relationships/options"
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def list(self, game: str = None) -> dict:
"""Lists all the games Battlemetrics can view.
@@ -56,7 +56,7 @@ async def list(self, game: str = None) -> dict:
if game:
data['fields[game]'] = game
url = f"{self.BASE_URL}/games"
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)

async def info(self, game_id: str, game: str = None) -> dict:
"""Gets information on a specific game.
@@ -74,4 +74,4 @@ async def info(self, game_id: str, game: str = None) -> dict:
if game:
data['fields[game]'] = game
url = f"{self.BASE_URL}/games/{game_id}"
return await self.helpers._make_request(method="GET", url=url, data=data)
return await self.helpers._make_request(method="GET", url=url, params=data)
Loading