Endpoint method names renamed to better represent urls
This commit is contained in:
parent
088219a60a
commit
bc4ba671d6
@ -1138,7 +1138,7 @@ class Citizen(classes.CitizenAPI):
|
||||
def collect_daily_task(self) -> None:
|
||||
self.update_citizen_info()
|
||||
if self.details.daily_task_done and not self.details.daily_task_reward:
|
||||
self._post_daily_task_reward()
|
||||
self._post_main_daily_task_reward()
|
||||
|
||||
def send_mail_to_owner(self) -> None:
|
||||
if not self.details.citizen_id == 1620414:
|
||||
@ -1314,7 +1314,7 @@ class Citizen(classes.CitizenAPI):
|
||||
return count
|
||||
|
||||
def _rw_choose_side(self, battle_id: int, side_id: int) -> Response:
|
||||
return self._post_battlefield_travel(side_id, battle_id)
|
||||
return self._post_main_battlefield_travel(side_id, battle_id)
|
||||
|
||||
def should_travel_to_fight(self) -> bool:
|
||||
ret = False
|
||||
@ -1594,7 +1594,7 @@ class Citizen(classes.CitizenAPI):
|
||||
return self.available_industries.get(industry_name, 0)
|
||||
|
||||
def buy_tg_contract(self) -> Response:
|
||||
ret = self._post_buy_gold_items('gold', "TrainingContract2", 1)
|
||||
ret = self._post_main_buy_gold_items('gold', "TrainingContract2", 1)
|
||||
self.reporter.report_action("BUY_TG_CONTRACT", ret.json())
|
||||
return ret
|
||||
|
||||
@ -1624,7 +1624,7 @@ class Citizen(classes.CitizenAPI):
|
||||
resp = self._get_main_citizen_hovercard(player_id)
|
||||
rjson = resp.json()
|
||||
if not any([rjson["isBanned"], rjson["isDead"], rjson["isFriend"], rjson["isOrg"], rjson["isSelf"]]):
|
||||
r = self._post_citizen_add_remove_friend(int(player_id), True)
|
||||
r = self._post_main_citizen_add_remove_friend(int(player_id), True)
|
||||
self.write_log("{:<64} (id:{:>11}) added as friend".format(rjson["name"], player_id))
|
||||
return r
|
||||
return resp
|
||||
@ -1824,7 +1824,7 @@ class Citizen(classes.CitizenAPI):
|
||||
return active_until
|
||||
|
||||
def collect_anniversary_reward(self) -> Response:
|
||||
return self._post_collect_anniversary_reward()
|
||||
return self._post_main_collect_anniversary_reward()
|
||||
|
||||
def get_battle_round_data(self, battle_id: int, round_id: int, division: int = None) -> dict:
|
||||
battle = self.all_battles.get(battle_id)
|
||||
@ -1844,7 +1844,7 @@ class Citizen(classes.CitizenAPI):
|
||||
return False
|
||||
data = dict(country=71, action='currency', value=amount)
|
||||
self.reporter.report_action("CONTRIBUTE_CC", data)
|
||||
r = self._post_country_donate(**data)
|
||||
r = self._post_main_country_donate(**data)
|
||||
return r.json().get('status') or not r.json().get('error')
|
||||
|
||||
def contribute_food_to_country(self, amount: int = 0, quality: int = 1) -> bool:
|
||||
@ -1854,7 +1854,7 @@ class Citizen(classes.CitizenAPI):
|
||||
return False
|
||||
data = dict(country=71, action='food', value=amount, quality=quality)
|
||||
self.reporter.report_action("CONTRIBUTE_FOOD", data)
|
||||
r = self._post_country_donate(**data)
|
||||
r = self._post_main_country_donate(**data)
|
||||
return r.json().get('status') or not r.json().get('error')
|
||||
|
||||
def contribute_gold_to_country(self, amount: int) -> bool:
|
||||
@ -1864,7 +1864,7 @@ class Citizen(classes.CitizenAPI):
|
||||
return False
|
||||
data = dict(country=71, action='gold', value=amount)
|
||||
self.reporter.report_action("CONTRIBUTE_GOLD", data)
|
||||
r = self._post_country_donate(**data)
|
||||
r = self._post_main_country_donate(**data)
|
||||
return r.json().get('status') or not r.json().get('error')
|
||||
|
||||
def write_on_country_wall(self, message: str) -> bool:
|
||||
|
@ -579,11 +579,11 @@ Class for unifying eRepublik known endpoints and their required/optional paramet
|
||||
data.update({"parentId": parent})
|
||||
return self.post("{}/main/articleComments/create".format(self.url), data=data)
|
||||
|
||||
def _post_battlefield_travel(self, side_id: int, battle_id: int) -> Response:
|
||||
def _post_main_battlefield_travel(self, side_id: int, battle_id: int) -> Response:
|
||||
data = dict(_token=self.token, sideCountryId=side_id, battleId=battle_id)
|
||||
return self.post("{}/main/battlefieldTravel".format(self.url), data=data)
|
||||
|
||||
def _post_buy_gold_items(self, currency: str, item: str, amount: int) -> Response:
|
||||
def _post_main_buy_gold_items(self, currency: str, item: str, amount: int) -> Response:
|
||||
data = dict(itemId=item, currency=currency, amount=amount, _token=self.token)
|
||||
return self.post("{}/main/buyGoldItems".format(self.url), data=data)
|
||||
|
||||
@ -591,7 +591,7 @@ Class for unifying eRepublik known endpoints and their required/optional paramet
|
||||
data = dict(_token=self.token, presentation=presentation)
|
||||
return self.post("{}/candidate-for-congress".format(self.url), data=data)
|
||||
|
||||
def _post_citizen_add_remove_friend(self, citizen: int, add: bool) -> Response:
|
||||
def _post_main_citizen_add_remove_friend(self, citizen: int, add: bool) -> Response:
|
||||
data = dict(_token=self.token, citizenId=citizen, url="//www.erepublik.com/en/main/citizen-addRemoveFriend")
|
||||
if add:
|
||||
data.update({"action": "addFriend"})
|
||||
@ -599,16 +599,16 @@ Class for unifying eRepublik known endpoints and their required/optional paramet
|
||||
data.update({"action": "removeFriend"})
|
||||
return self.post("{}/main/citizen-addRemoveFriend".format(self.url), data=data)
|
||||
|
||||
def _post_collect_anniversary_reward(self) -> Response:
|
||||
def _post_main_collect_anniversary_reward(self) -> Response:
|
||||
return self.post("{}/main/collect-anniversary-reward".format(self.url), data={"_token": self.token})
|
||||
|
||||
def _post_country_donate(self, country: int, action: str, value: Union[int, float],
|
||||
def _post_main_country_donate(self, country: int, action: str, value: Union[int, float],
|
||||
quality: int = None) -> Response:
|
||||
json = dict(countryId=country, action=action, _token=self.token, value=value, quality=quality)
|
||||
return self.post("{}/main/country-donate".format(self.url), data=json,
|
||||
headers={"Referer": "{}/country/economy/Latvia".format(self.url)})
|
||||
|
||||
def _post_daily_task_reward(self) -> Response:
|
||||
def _post_main_daily_task_reward(self) -> Response:
|
||||
return self.post("{}/main/daily-tasks-reward".format(self.url), data=dict(_token=self.token))
|
||||
|
||||
def _post_main_donate_article(self, article_id: int, amount: int) -> Response:
|
||||
|
Loading…
x
Reference in New Issue
Block a user