Article voting and endorsing
This commit is contained in:
parent
bc4ba671d6
commit
95570b7c17
@ -1943,3 +1943,14 @@ class Citizen(classes.CitizenAPI):
|
|||||||
elite = 1.1 if elite else 1
|
elite = 1.1 if elite else 1
|
||||||
dmg = int(dmg * elite)
|
dmg = int(dmg * elite)
|
||||||
return dmg * (1.1 if ne else 1.)
|
return dmg * (1.1 if ne else 1.)
|
||||||
|
|
||||||
|
def endorse_article(self, article_id: int, amount: int) -> bool:
|
||||||
|
if amount in (5, 50, 100):
|
||||||
|
resp = self._post_main_donate_article(article_id, amount).json()
|
||||||
|
return not bool(resp.get('error'))
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def vote_article(self, article_id: int) -> bool:
|
||||||
|
resp = self._post_main_vote_article(article_id).json()
|
||||||
|
return not bool(resp.get('error'))
|
||||||
|
@ -800,6 +800,10 @@ Class for unifying eRepublik known endpoints and their required/optional paramet
|
|||||||
data = dict(_token=self.token, check=check, **kwargs)
|
data = dict(_token=self.token, check=check, **kwargs)
|
||||||
return self.post("{}/main/travel".format(self.url), data=data)
|
return self.post("{}/main/travel".format(self.url), data=data)
|
||||||
|
|
||||||
|
def _post_main_vote_article(self, article_id: int) -> Response:
|
||||||
|
data = dict(_token=self.token, articleId=article_id)
|
||||||
|
return self.post("{}/main/vote-article".format(self.url), data=data)
|
||||||
|
|
||||||
def _post_main_travel_data(self, **kwargs) -> Response:
|
def _post_main_travel_data(self, **kwargs) -> Response:
|
||||||
return self.post("{}/main/travelData".format(self.url), data=dict(_token=self.token, **kwargs))
|
return self.post("{}/main/travelData".format(self.url), data=dict(_token=self.token, **kwargs))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user