diff --git a/erepublik/access_points.py b/erepublik/access_points.py index 8efb42c..89ff1f7 100644 --- a/erepublik/access_points.py +++ b/erepublik/access_points.py @@ -161,14 +161,14 @@ class ErepublikArticleAPI(CitizenBaseAPI): def _get_main_article_json(self, article_id: int) -> Response: return self.get("{}/main/articleJson/{}".format(self.url, article_id)) - def _post_main_article_comments(self, article: int, page: int = 1) -> Response: - data = dict(_token=self.token, articleId=article, page=page) + def _post_main_article_comments(self, article_id: int, page: int = 1) -> Response: + data = dict(_token=self.token, articleId=article_id, page=page) if page: data.update({'page': page}) return self.post("{}/main/articleComments".format(self.url), data=data) - def _post_main_article_comments_create(self, message: str, article: int, parent: int = 0) -> Response: - data = dict(_token=self.token, message=message, articleId=article) + def _post_main_article_comments_create(self, message: str, article_id: int, parent: int = 0) -> Response: + data = dict(_token=self.token, message=message, articleId=article_id) if parent: data.update({"parentId": parent}) return self.post("{}/main/articleComments/create".format(self.url), data=data) @@ -177,9 +177,9 @@ class ErepublikArticleAPI(CitizenBaseAPI): data = dict(_token=self.token, articleId=article_id, amount=amount) return self.post("{}/main/donate-article".format(self.url), data=data) - def _post_main_write_article(self, title: str, content: str, country: int, kind: int) -> Response: - data = dict(_token=self.token, article_name=title, article_body=content, article_location=country, - article_category=kind) + def _post_main_write_article(self, title: str, content: str, country_id: int, kind_id: int) -> Response: + data = dict(_token=self.token, article_name=title, article_body=content, article_location=country_id, + article_category=kind_id) return self.post("{}/main/write-article".format(self.url), data=data) def _post_main_vote_article(self, article_id: int) -> Response: @@ -188,12 +188,12 @@ class ErepublikArticleAPI(CitizenBaseAPI): class ErepublikCompanyAPI(CitizenBaseAPI): - def _post_economy_assign_to_holding(self, factory: int, holding: int) -> Response: - data = dict(_token=self.token, factoryId=factory, action="assign", holdingCompanyId=holding) + def _post_economy_assign_to_holding(self, factory_id: int, holding_id: int) -> Response: + data = dict(_token=self.token, factoryId=factory_id, action="assign", holdingCompanyId=holding_id) return self.post("{}/economy/assign-to-holding".format(self.url), data=data) - def _post_economy_create_company(self, industry: int, building_type: int = 1) -> Response: - data = {"_token": self.token, "company[industry_id]": industry, "company[building_type]": building_type} + def _post_economy_create_company(self, industry_id: int, building_type: int = 1) -> Response: + data = {"_token": self.token, "company[industry_id]": industry_id, "company[building_type]": building_type} return self.post("{}/economy/create-company".format(self.url), data=data, headers={"Referer": "{}/economy/create-company".format(self.url)}) diff --git a/erepublik/citizen.py b/erepublik/citizen.py index 974ec5c..a1b169c 100644 --- a/erepublik/citizen.py +++ b/erepublik/citizen.py @@ -855,11 +855,7 @@ class CitizenCompanies(BaseCitizen): Storage={1000: 1, 2000: 2} <- Building_type 2 """ - company_name = {1: "Food", 2: "Weapons", 4: "House", 23: "Aircraft", - 7: "FRM q1", 8: "FRM q2", 9: "FRM q3", 10: "FRM q4", 11: "FRM q5", - 12: "WRM q1", 13: "WRM q2", 14: "WRM q3", 15: "WRM q4", 16: "WRM q5", - 18: "HRM q1", 19: "HRM q2", 20: "HRM q3", 21: "HRM q4", 22: "HRM q5", - 24: "ARM q1", 25: "ARM q2", 26: "ARM q3", 27: "ARM q4", 28: "ARM q5", }[industry_id] + company_name = constants.INDUSTRIES[industry_id] if building_type == 2: company_name = "Storage" self.write_log(f'{company_name} created!') @@ -1260,8 +1256,8 @@ class CitizenMedia(BaseCitizen): 4: "Political debates and analysis", 5: "Financial business", 6: "Social interactions and entertainment"} if kind in kinds: - data = {'title': title, 'content': content, 'country': self.details.citizenship, 'kind': kind} - resp = self._post_main_write_article(**data) + data = {'title': title, 'content': content, 'country': self.details.citizenship.id, 'kind': kind} + resp = self._post_main_write_article(title, content, self.details.citizenship.id, kind) try: article_id = int(resp.history[1].url.split("/")[-3]) self._report_action("ARTICLE_PUBLISH", f"Published new article \"{title}\" ({article_id})", kwargs=data)