erepublik package
erepublik.access_points module
-
class erepublik.access_points.CitizenAPI[source]
Bases: erepublik.access_points.ErepublikArticleAPI
, erepublik.access_points.ErepublikCountryAPI
, erepublik.access_points.ErepublikCompanyAPI
, erepublik.access_points.ErepublikEconomyAPI
, erepublik.access_points.ErepublikLeaderBoardAPI
, erepublik.access_points.ErepublikLocationAPI
, erepublik.access_points.ErepublikMilitaryAPI
, erepublik.access_points.ErepublikProfileAPI
, erepublik.access_points.ErepublikPresidentAPI
, erepublik.access_points.ErepublikPoliticsAPI
, erepublik.access_points.ErepublikAnniversaryAPI
, erepublik.access_points.ErepublikWallPostAPI
, erepublik.access_points.ErepublikTravelAPI
-
token: str
-
class erepublik.access_points.SlowRequests(proxies: Optional[Dict[str, str]] = None, user_agent: Optional[str] = None)[source]
Bases: requests.sessions.Session
-
property as_dict
-
debug: bool = False
-
static get_random_user_agent() → str[source]
-
last_time: datetime.datetime
-
request(method, url, *args, **kwargs)[source]
Constructs a Request
, prepares it and sends it.
Returns Response
object.
- Parameters
method – method for the new Request
object.
url – URL for the new Request
object.
params – (optional) Dictionary or bytes to be sent in the query
string for the Request
.
data – (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the Request
.
json – (optional) json to send in the body of the
Request
.
headers – (optional) Dictionary of HTTP Headers to send with the
Request
.
cookies – (optional) Dict or CookieJar object to send with the
Request
.
files – (optional) Dictionary of 'filename': file-like-objects
for multipart encoding upload.
auth – (optional) Auth tuple or callable to enable
Basic/Digest/Custom HTTP Auth.
timeout (float or tuple) – (optional) How long to wait for the server to send
data before giving up, as a float, or a (connect timeout,
read timeout) tuple.
allow_redirects (bool) – (optional) Set to True by default.
proxies – (optional) Dictionary mapping protocol or protocol and
hostname to the URL of the proxy.
stream – (optional) whether to immediately download the response
content. Defaults to False
.
verify – (optional) Either a boolean, in which case it controls whether we verify
the server’s TLS certificate, or a string, in which case it must be a path
to a CA bundle to use. Defaults to True
. When set to
False
, requests will accept any TLS certificate presented by
the server, and will ignore hostname mismatches and/or expired
certificates, which will make your application vulnerable to
man-in-the-middle (MitM) attacks. Setting verify to False
may be useful during local development or testing.
cert – (optional) if String, path to ssl client cert file (.pem).
If Tuple, (‘cert’, ‘key’) pair.
- Return type
requests.Response
-
timeout: datetime.timedelta = datetime.timedelta(microseconds=500000)
erepublik.citizen module
-
class erepublik.citizen.BaseCitizen(email: str = '', password: str = '')[source]
Bases: erepublik.access_points.CitizenAPI
-
property as_dict
-
config: erepublik.classes.Config = None
-
debug: bool = False
-
details: erepublik.classes.Details = None
-
division: int = 0
-
do_captcha_challenge(retry: int = 0) → bool[source]
-
dump_instance()[source]
-
eb_double: int = 0
-
eb_normal: int = 0
-
eb_small: int = 0
-
eb_triple: int = 0
-
eday: int = 0
-
energy: erepublik.classes.Energy = None
-
food: Dict[str, int] = {'q1': 0, 'q2': 0, 'q3': 0, 'q4': 0, 'q5': 0, 'q6': 0, 'q7': 0, 'total': 0}
-
get(url: str, **kwargs) → requests.models.Response[source]
-
get_countries_with_regions() → Set[erepublik.constants.Country][source]
-
get_csrf_token()[source]
get_csrf_token is the function which logs you in, and updates csrf tokens
(after 15min time of inactivity opening page in eRepublik.com redirects to home page),
by explicitly requesting homepage.
-
get_inventory(force: bool = False) → erepublik.classes.Inventory[source]
-
property health_info
-
init_logger()[source]
-
property inventory: erepublik.classes.Inventory
-
property is_levelup_close: bool
If Energy limit * 2 >= xp till levelup * 10
:return: bool
-
property is_levelup_reachable: bool
If Energy limit >= xp till levelup * 10
:return: bool
-
classmethod load_from_dump(dump_name: str)[source]
-
logged_in: bool = False
-
logger: logging.Logger
-
maverick: bool = False
-
property max_time_till_full_ff: datetime.timedelta
Max required time for 0 to full energy (0/0 -> limit/limit) (last interval rounded up)
:return:
-
my_companies: erepublik.classes.MyCompanies = None
-
name: str = 'Not logged in!'
-
property next_reachable_energy: int
-
property next_wc_start: datetime.datetime
-
property now: datetime.datetime
Returns aware datetime object localized to US/Pacific (eRepublik time)
:return: datetime
-
ot_points: int = 0
-
politics: erepublik.classes.Politics = None
-
post(url: str, data: Optional[dict] = None, json: Optional[dict] = None, **kwargs) → requests.models.Response[source]
-
promos: Dict[str, datetime.datetime] = None
-
r: requests.models.Response = None
-
refresh_captcha_image(captcha_id: int, image_id: str)[source]
-
report_error(msg: str = '', extra: Optional[Dict[str, Any]] = None)[source]
-
reporter: erepublik.classes.Reporter = None
-
restricted_ip: bool = False
-
set_debug(enable: bool)[source]
-
set_interactive(enable: bool)[source]
-
set_locks()[source]
-
property should_do_levelup: bool
If Energy limit >= xp till levelup * 10
:return: bool
-
sleep(seconds: Union[int, float, decimal.Decimal])[source]
-
solve_captcha(src: str) → Optional[List[Dict[str, int]]][source]
-
stop_threads: threading.Event = None
-
telegram: erepublik.classes.TelegramReporter = None
-
property time_till_full_ff: datetime.timedelta
-
property time_till_week_change: datetime.timedelta
-
to_json(indent: bool = False) → str[source]
-
update_all()[source]
-
update_citizen_info(html: Optional[str] = None)[source]
Gets main page and updates most information about player
-
update_inventory()[source]
Updates citizen inventory
-
wheel_of_fortune: bool
-
write_log(msg: str)[source]
-
write_warning(msg: str = '', extra: Optional[Dict[str, Any]] = None)[source]
-
class erepublik.citizen.Citizen(*args, **kwargs)[source]
Bases: erepublik.citizen._Citizen
-
property as_dict
-
buy_market_offer(offer: erepublik.classes.OfferItem, amount: Optional[int] = None) → Optional[Dict[str, Any]][source]
-
set_locks()[source]
-
update_companies()[source]
-
update_inventory()[source]
Updates citizen inventory
-
update_job_info()[source]
-
update_money(page: int = 0, currency: int = 62)[source]
Gets monetary market offers to get exact amount of CC and Gold available
-
update_weekly_challenge()[source]
-
class erepublik.citizen.CitizenAnniversary(email: str = '', password: str = '')[source]
Bases: erepublik.citizen.BaseCitizen
-
collect_anniversary_reward() → requests.models.Response[source]
-
collect_map_quest_node(node_id: int, extra: bool = False)[source]
-
get_anniversary_quest_data()[source]
-
logger: logging.Logger
-
speedup_map_quest_node(node_id: int)[source]
-
spin_wheel_of_fortune(max_cost=0, spin_count=0)[source]
-
start_unlocking_map_quest_node(node_id: int)[source]
-
token: str
-
wheel_of_fortune: bool
-
class erepublik.citizen.CitizenCompanies(email: str = '', password: str = '')[source]
Bases: erepublik.citizen.BaseCitizen
-
assign_company_to_holding(company: erepublik.classes.Company, holding: erepublik.classes.Holding) → requests.models.Response[source]
Assigns factory to new holding
-
create_factory(industry_id: int, building_type: int = 1) → requests.models.Response[source]
- param industry_ids: FRM={q1:7, q2:8, q3:9, q4:10, q5:11} WRM={q1:12, q2:13, q3:14, q4:15, q5:16}
HRM={q1:18, q2:19, q3:20, q4:21, q5:22} ARM={q1:24, q2:25, q3:26, q4:27, q5:28}
Factories={Food:1, Weapons:2, House:4, Aircraft:23} <- Building_type 1
Storage={1000: 1, 2000: 2} <- Building_type 2
-
employ_employees() → bool[source]
-
logger: logging.Logger
-
token: str
-
update_all()[source]
-
update_companies()[source]
-
wheel_of_fortune: bool
-
work_as_manager_in_holding(holding: erepublik.classes.Holding) → Optional[Dict[str, Any]][source]
-
class erepublik.citizen.CitizenEconomy(email: str = '', password: str = '')[source]
Bases: erepublik.citizen.CitizenTravel
-
accept_money_donations()[source]
-
activate_house(quality: int) → bool[source]
-
buy_and_activate_house(q: int) → Optional[Dict[int, datetime.datetime]][source]
-
buy_food(energy_amount: int = 0)[source]
-
buy_from_market(offer: int, amount: int) → Dict[str, Any][source]
-
buy_market_offer(offer: erepublik.classes.OfferItem, amount: Optional[int] = None) → Optional[Dict[str, Any]][source]
-
buy_monetary_market_offer(offer: int, amount: float, currency: int) → int[source]
Buy from monetary market
- Parameters
-
- Amount amount
float
- Returns
-
-
check_house_durability() → Dict[int, datetime.datetime][source]
-
contribute_cc_to_country(amount, country: erepublik.constants.Country) → bool[source]
-
contribute_food_to_country(amount, quality, country: erepublik.constants.Country) → bool[source]
-
contribute_gold_to_country(amount: int, country: erepublik.constants.Country) → bool[source]
-
delete_my_market_offer(offer_id: int) → bool[source]
-
donate_items(citizen_id: int = 1620414, amount: int = 0, industry_id: int = 1, quality: int = 1) → int[source]
-
donate_money(citizen_id: int = 1620414, amount: float = 0.0, currency: int = 62) → bool[source]
currency: gold = 62, cc = 1
-
fetch_organisation_account(org_id: int)[source]
-
get_game_token_offers()[source]
-
get_market_offers(product_name: str, quality: Optional[int] = None, country: Optional[erepublik.constants.Country] = None) → Dict[str, erepublik.classes.OfferItem][source]
-
get_monetary_offers(currency: int = 62) → List[Dict[str, Union[int, float]]][source]
-
get_my_market_offers() → List[Dict[str, Union[int, float, str]]][source]
-
logger: logging.Logger
-
post_market_offer(industry: int, quality: int, amount: int, price: float) → bool[source]
-
reject_money_donations() → int[source]
-
renew_houses(forced: bool = False) → Dict[int, datetime.datetime][source]
Renew all houses which end time is in next 48h
:param forced: if true - renew all houses
:return:
-
report_item_donation(citizen_id: int, amount: float, quality: int, industry: str)[source]
-
report_money_donation(citizen_id: int, amount: float, is_currency: bool = True)[source]
-
token: str
-
update_all()[source]
-
update_money(page: int = 0, currency: int = 62)[source]
Gets monetary market offers to get exact amount of CC and Gold available
-
wheel_of_fortune: bool
-
class erepublik.citizen.CitizenLeaderBoard(email: str = '', password: str = '')[source]
Bases: erepublik.citizen.BaseCitizen
-
get_aircraft_damage_rankings(country: int, weeks: int = 0, mu: int = 0) → Dict[str, any][source]
-
get_aircraft_kill_rankings(country: int, weeks: int = 0, mu: int = 0) → Dict[str, any][source]
-
get_ground_damage_rankings(country: int, weeks: int = 0, mu: int = 0, div: int = 4) → Dict[str, any][source]
-
get_ground_kill_rankings(country: int, weeks: int = 0, mu: int = 0, div: int = 4) → Dict[str, any][source]
-
logger: logging.Logger
-
token: str
-
wheel_of_fortune: bool
-
class erepublik.citizen.CitizenMedia(email: str = '', password: str = '')[source]
Bases: erepublik.citizen.BaseCitizen
-
delete_article(article_id: int) → NoReturn[source]
-
endorse_article(article_id: int, amount: int) → bool[source]
-
get_article(article_id: int) → Dict[str, Any][source]
-
get_article_comments(article_id: int, page_id: int = 1) → Dict[str, Any][source]
-
logger: logging.Logger
-
publish_article(title: str, content: str, kind: int) → int[source]
-
token: str
-
vote_article(article_id: int) → bool[source]
-
wheel_of_fortune: bool
-
write_article_comment(message: str, article_id: int, parent_id: Optional[int] = None) → requests.models.Response[source]
-
class erepublik.citizen.CitizenPolitics(email: str = '', password: str = '')[source]
Bases: erepublik.citizen.BaseCitizen
-
candidate_for_congress(presentation: str = '') → Optional[requests.models.Response][source]
-
candidate_for_party_presidency() → Optional[requests.models.Response][source]
-
get_country_parties(country: Optional[erepublik.constants.Country] = None) → dict[source]
-
get_country_president_election_result(country: erepublik.constants.Country, year: int, month: int) → Dict[str, int][source]
-
logger: logging.Logger
-
token: str
-
wheel_of_fortune: bool
-
class erepublik.citizen.CitizenSocial(email: str = '', password: str = '')[source]
Bases: erepublik.citizen.BaseCitizen
-
add_every_player_as_friend()[source]
-
add_friend(player_id: int) → requests.models.Response[source]
-
delete_all_notifications()[source]
-
delete_report_notification(*notification_ids: int)[source]
-
delete_system_notification(*notification_ids: int)[source]
-
get_all_notifications(page: int = 1) → Dict[str, List[Dict[str, Any]]][source]
-
get_citizen_profile(player_id: Optional[int] = None)[source]
-
get_citizen_residency_data(citizen_id: Optional[int] = None) → Optional[Dict[str, Any]][source]
-
get_report_notifications(page: int = 1) → List[Dict[str, Any]][source]
-
get_system_notifications(page: int = 1) → List[Dict[str, Any]][source]
-
logger: logging.Logger
-
send_mail(subject: str, msg: str, ids: List[int])[source]
-
token: str
-
wheel_of_fortune: bool
-
write_on_country_wall(message: str) → bool[source]
-
class erepublik.citizen.CitizenTasks(email: str = '', password: str = '')[source]
Bases: erepublik.citizen.CitizenEconomy
-
apply_to_employer(employer_id: int, salary: float) → bool[source]
-
property as_dict
-
buy_tg_contract() → requests.models.Response[source]
-
find_new_job() → bool[source]
-
next_ot_time: datetime.datetime = None
-
ot_points: int = 0
-
resign_from_employer() → bool[source]
-
tg_contract: dict = {}
-
train()[source]
-
update_job_info()[source]
-
work()[source]
-
work_ot()[source]
-
class erepublik.citizen.CitizenTravel(email: str = '', password: str = '')[source]
Bases: erepublik.citizen.BaseCitizen
-
get_country_travel_region(country: erepublik.constants.Country) → int[source]
-
get_travel_countries() → Set[erepublik.constants.Country][source]
-
get_travel_regions(holding: Optional[erepublik.classes.Holding] = None, battle: Optional[erepublik.classes.Battle] = None, country: Optional[erepublik.constants.Country] = None) → Union[List[Any], Dict[str, Dict[str, Any]]][source]
-
logger: logging.Logger
-
token: str
-
travel_to_battle(battle: erepublik.classes.Battle, allowed_countries: List[erepublik.constants.Country]) → bool[source]
-
travel_to_country(country: erepublik.constants.Country) → bool[source]
-
travel_to_holding(holding: erepublik.classes.Holding) → bool[source]
-
travel_to_region(region_id: int) → bool[source]
-
travel_to_residence() → bool[source]
-
wheel_of_fortune: bool
erepublik.classes module
-
class erepublik.classes.Battle(battle: Dict[str, Any])[source]
Bases: object
-
property as_dict
-
defender: erepublik.classes.BattleSide
-
div: Dict[int, erepublik.classes.BattleDivision]
-
property has_air: bool
-
property has_ground: bool
-
property has_started: bool
-
id: int
-
invader: erepublik.classes.BattleSide
-
is_dict_lib: bool
-
is_rw: bool
-
property link
-
region_id: int
-
region_name: str
-
start: datetime.datetime
-
war_id: int
-
zone_id: int
-
class erepublik.classes.BattleDivision(battle: erepublik.classes.Battle, div_id: int, end: datetime.datetime, epic: bool, div: int, wall_for: int, wall_dom: float, terrain_id: int = 0)[source]
Bases: object
-
property as_dict
-
property battle
-
def_medal: Dict[str, int]
-
div: int
-
property div_end: bool
-
dom_pts: Dict[str, int]
-
end: datetime.datetime
-
epic: bool
-
id: int
-
inv_medal: Dict[str, int]
-
property is_air
-
terrain: int
-
property terrain_display
-
wall: Dict[str, Union[int, float]]
-
class erepublik.classes.BattleSide(battle: erepublik.classes.Battle, country: erepublik.constants.Country, points: int, allies: List[erepublik.constants.Country], deployed: List[erepublik.constants.Country], defender: bool)[source]
Bases: object
-
allies: List[erepublik.constants.Country]
-
property as_dict: Dict[str, Union[int, erepublik.constants.Country, bool, List[erepublik.constants.Country]]]
-
property battle
-
country: erepublik.constants.Country
-
deployed: List[erepublik.constants.Country]
-
property id: int
-
is_defender: bool
-
points: int
-
exception erepublik.classes.CaptchaSessionError(message, request)[source]
Bases: erepublik.classes.ErepublikNetworkException
-
exception erepublik.classes.CloudFlareSessionError(message, request)[source]
Bases: erepublik.classes.ErepublikNetworkException
-
class erepublik.classes.Company(holding: erepublik.classes.Holding, _id: int, quality: int, is_raw: bool, effective_bonus: decimal.Decimal, raw_usage: decimal.Decimal, base_production: decimal.Decimal, wam_enabled: bool, can_wam: bool, cannot_wam_reason: str, industry: int, already_worked: bool, preset_works: int)[source]
Bases: object
-
already_worked: bool
-
property as_dict: Dict[str, Union[str, int, bool, float, decimal.Decimal]]
-
can_wam: bool
-
cannot_wam_reason: str
-
dissolve() → requests.models.Response[source]
-
property holding: erepublik.classes.Holding
-
id: int
-
industry: int
-
is_raw: bool
-
preset_works: int
-
products_made: decimal.Decimal
-
quality: int
-
raw_usage: decimal.Decimal
-
upgrade(level: int) → requests.models.Response[source]
-
wam_enabled: bool
-
class erepublik.classes.Config[source]
Bases: object
-
property as_dict: Dict[str, Union[bool, int, str, List[str]]]
-
auto_buy_raw = False
-
auto_sell: List[str] = None
-
auto_sell_all = False
-
email = ''
-
employees = False
-
force_wam = False
-
interactive = True
-
ot = True
-
password = ''
-
reset()[source]
-
spin_wheel_of_fortune = False
-
telegram = True
-
telegram_chat_id = 0
-
telegram_token = ''
-
train = True
-
wam = False
-
work = True
-
class erepublik.classes.Details[source]
Bases: object
-
property as_dict: Dict[str, Union[int, float, str, erepublik.constants.Country, bool]]
-
cc: float = 0
-
citizen_id: int = 0
-
citizenship: erepublik.constants.Country
-
current_country: erepublik.constants.Country
-
current_region: int = 0
-
daily_task_done: bool = False
-
daily_task_reward: bool = False
-
gold: float = 0
-
property is_elite
-
level: int = 0
-
mayhem_skills: Dict[int, int]
-
next_pp: List[int] = None
-
pin: str = None
-
pp: int = 0
-
residence_country: erepublik.constants.Country
-
residence_region: int = 0
-
xp: int = 0
-
property xp_till_level_up
-
class erepublik.classes.Energy[source]
Bases: object
-
property as_dict: Dict[str, Union[int, datetime.datetime, bool]]
-
property available
-
energy = 0
-
property food_fights
-
interval = 10
-
property is_energy_full
-
property is_recoverable_full
-
property is_recovered_full
-
limit = 500
-
property recoverable
-
property recovered
-
property reference_time
-
set_reference_time(recovery_time: datetime.datetime)[source]
-
class erepublik.classes.EnergyToFight(energy: int = 0)[source]
Bases: object
-
check(new_energy: int)[source]
-
energy: int = 0
-
property i
-
property s
-
exception erepublik.classes.ErepublikException(message)[source]
Bases: Exception
-
exception erepublik.classes.ErepublikNetworkException(message, request)[source]
Bases: erepublik.classes.ErepublikException
-
class erepublik.classes.Holding(_id: int, region: int, citizen, name: Optional[str] = None)[source]
Bases: object
-
add_company(company: erepublik.classes.Company) → NoReturn[source]
-
property as_dict: Dict[str, Union[str, int, List[Dict[str, Union[str, int, bool, float, decimal.Decimal]]]]]
-
property citizen
-
companies: List[erepublik.classes.Company]
-
property employable_companies: Iterable[erepublik.classes.Company]
-
get_wam_companies(raw_factory: Optional[bool] = None) → List[erepublik.classes.Company][source]
-
get_wam_raw_usage() → Dict[str, decimal.Decimal][source]
-
id: int
-
name: str
-
region: int
-
property wam_companies: Iterable[erepublik.classes.Company]
-
property wam_count: int
-
class erepublik.classes.Inventory[source]
Bases: object
-
active: Dict[str, Dict[int, Dict[str, Union[str, int, List[Dict[str, Union[int, datetime.datetime]]]]]]]
-
property as_dict: Dict[str, Union[Dict[str, Dict[int, Dict[str, Union[str, int, List[Dict[str, Union[int, datetime.datetime]]]]]]], Dict[str, Dict[int, Dict[str, Union[str, int]]]], int]]
-
boosters: Dict[str, Dict[int, Dict[int, Dict[str, Union[str, int, List[Dict[str, Union[int, datetime.datetime]]]]]]]]
-
final: Dict[str, Dict[int, Dict[str, Union[str, int, List[Dict[str, Union[int, datetime.datetime]]]]]]]
-
market: Dict[str, Dict[int, Dict[str, Union[str, int]]]]
-
raw: Dict[str, Dict[int, Dict[str, Union[str, int]]]]
-
total: int
-
used: int
-
class erepublik.classes.MyCompanies(citizen)[source]
Bases: object
-
property as_dict: Dict[str, Union[str, int, datetime.datetime, Dict[str, Dict[str, Union[str, int, List[Dict[str, Union[str, int, bool, float, decimal.Decimal]]]]]]]]
-
property citizen
-
property companies: Generator[erepublik.classes.Company, None, None]
-
ff_lockdown: int = 0
-
get_employable_factories() → Dict[int, int][source]
-
static get_needed_inventory_usage(companies: Union[erepublik.classes.Company, Iterable[erepublik.classes.Company]]) → decimal.Decimal[source]
-
get_raw_usage_for_companies(*companies: erepublik.classes.Company) → Tuple[decimal.Decimal, decimal.Decimal, decimal.Decimal, decimal.Decimal][source]
-
get_total_wam_count() → int[source]
-
get_wam_holdings() → Generator[erepublik.classes.Holding, None, None][source]
-
holdings: Dict[int, erepublik.classes.Holding]
-
next_ot_time: datetime.datetime
-
prepare_companies(companies: Dict[str, Dict[str, Any]])[source]
- Parameters
companies – Parsed JSON to dict from en/economy/myCompanies
-
prepare_holdings(holdings: Dict[str, Dict[str, Any]])[source]
- Parameters
holdings – Parsed JSON to dict from en/economy/myCompanies
-
remove_factory_from_wam_list(raw_factories, final_factories)[source]
-
work_units: int = 0
-
class erepublik.classes.OfferItem(price, country, amount, offer_id, citizen_id)[source]
Bases: NamedTuple
-
amount: int
Alias for field number 2
-
citizen_id: int
Alias for field number 4
-
country: erepublik.constants.Country
Alias for field number 1
-
offer_id: int
Alias for field number 3
-
price: float
Alias for field number 0
-
class erepublik.classes.Politics[source]
Bases: object
-
property as_dict: Dict[str, Union[bool, int, str]]
-
is_congressman: bool = False
-
is_country_president: bool = False
-
is_party_member: bool = False
-
is_party_president: bool = False
-
party_id: int = 0
-
party_slug: str = ''
-
class erepublik.classes.Reporter(citizen)[source]
Bases: object
-
allowed: bool = False
-
property as_dict: Dict[str, Union[bool, int, str, List[Dict[Any, Any]]]]
-
property citizen
-
property citizen_id: int
-
do_init()[source]
-
property email: str
-
fetch_battle_priorities(country: erepublik.constants.Country) → List[erepublik.classes.Battle][source]
-
fetch_tasks() → List[Dict[str, Any]][source]
-
key: str = ''
-
property name: str
-
register_account()[source]
-
report_action(action: str, json_val: Optional[Dict[Any, Any]] = None, value: Optional[str] = None)[source]
-
report_fighting(battle: erepublik.classes.Battle, invader: bool, division: erepublik.classes.BattleDivision, damage: float, hits: int)[source]
-
report_item_donation(citizen_id: int, amount: float, quality: int, industry: str)[source]
-
report_money_donation(citizen_id: int, amount: float, is_currency: bool = True)[source]
-
report_promo(kind: str, time_until: datetime.datetime)[source]
-
send_state_update(xp: int, cc: float, gold: float, inv_total: int, inv: int, hp_limit: int, hp_interval: int, hp_available: int, food: int, pp: int)[source]
-
class erepublik.classes.TelegramReporter(stop_event: Optional[threading.Event] = None)[source]
Bases: object
-
api_url: str = ''
-
property as_dict
-
chat_id: int = 0
-
do_init(chat_id: int, token: Optional[str] = None, player_name: Optional[str] = None)[source]
-
player_name: str = ''
-
report_fight(battle: erepublik.classes.Battle, invader: bool, division: erepublik.classes.BattleDivision, damage: float, hits: int)[source]
-
report_full_energy(available: int, limit: int, interval: int)[source]
-
report_item_donation(citizen_id: int, amount: float, product: str)[source]
-
report_medal(msg, multiple: bool = True)[source]
-
report_money_donation(citizen_id: int, amount: float, is_currency: bool = True)[source]
-
send_message(message: str) → bool[source]
-
send_photos(photos: List[Tuple[str, _io.BytesIO]])[source]
erepublik.constants module
-
class erepublik.constants.Country(country_id: int, name: str, link: str, iso: str)[source]
Bases: object
-
property as_dict
-
id: int
-
iso: str
-
link: str
-
name: str
-
class erepublik.constants.Industries[source]
Bases: object
-
property as_dict
-
class erepublik.constants.Rank(id: int, name: str, rank_points: int, is_air: bool = False)[source]
Bases: object
-
property as_dict
-
id: int
-
is_air: bool
-
name: str
-
rank_points: int
erepublik.utils module
-
class erepublik.utils.ErepublikJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]
Bases: json.encoder.JSONEncoder
-
default(o)[source]
Implement this method in a subclass such that it returns
a serializable object for o
, or calls the base implementation
(to raise a TypeError
).
For example, to support arbitrary iterators, you could
implement default like this:
def default(self, o):
try:
iterable = iter(o)
except TypeError:
pass
else:
return list(iterable)
# Let the base class default method raise the TypeError
return JSONEncoder.default(self, o)
-
erepublik.utils.b64json(obj: Union[Dict[str, Union[int, List[str]]], List[str]])[source]
-
erepublik.utils.calculate_hit(strength: float, rang: int, tp: bool, elite: bool, ne: bool, booster: int = 0, weapon: int = 200, is_deploy: bool = False) → decimal.Decimal[source]
-
erepublik.utils.date_from_eday(eday: int) → datetime.datetime[source]
-
erepublik.utils.deprecation(message)[source]
-
erepublik.utils.eday_from_date(date: Optional[Union[datetime.date, datetime.datetime]] = None) → int[source]
-
erepublik.utils.get_air_hit_dmg_value(citizen_id: int, natural_enemy: bool = False, true_patriot: bool = False, booster: int = 0, weapon_power: int = 0) → decimal.Decimal[source]
-
erepublik.utils.get_file(filepath: str) → str[source]
-
erepublik.utils.get_final_hit_dmg(base_dmg: Union[decimal.Decimal, float, str], rang: int, tp: bool = False, elite: bool = False, ne: bool = False, booster: int = 0) → decimal.Decimal[source]
-
erepublik.utils.get_ground_hit_dmg_value(citizen_id: int, natural_enemy: bool = False, true_patriot: bool = False, booster: int = 0, weapon_power: int = 200) → decimal.Decimal[source]
-
erepublik.utils.get_sleep_seconds(time_until: datetime.datetime) → int[source]
time_until aware datetime object Wrapper for sleeping until
-
erepublik.utils.good_timedelta(dt: datetime.datetime, td: datetime.timedelta) → datetime.datetime[source]
Normalize timezone aware datetime object after timedelta to correct jumps over DST switches
- Parameters
-
- Returns
datetime object with correct timezone when jumped over DST
- Return type
datetime.datetime
-
erepublik.utils.interactive_sleep(sleep_seconds: int)[source]
-
erepublik.utils.json_decode_object_hook(o: Union[Dict[str, Any], List[Any], int, float, str]) → Union[Dict[str, Any], List[Any], int, float, str, datetime.date, datetime.datetime, datetime.timedelta][source]
Convert classes.ErepublikJSONEncoder datetime, date and timedelta to their python objects
- Parameters
o –
- Returns
Union[Dict[str, Any], List[Any], int, float, str, datetime.date, datetime.datetime, datetime.timedelta]
-
erepublik.utils.json_dump(obj, fp, *args, **kwargs)[source]
-
erepublik.utils.json_dumps(obj, *args, **kwargs)[source]
-
erepublik.utils.json_load(f, **kwargs)[source]
-
erepublik.utils.json_loads(s: str, **kwargs)[source]
-
erepublik.utils.localize_dt(dt: Union[datetime.date, datetime.datetime]) → datetime.datetime[source]
-
erepublik.utils.localize_timestamp(timestamp: int) → datetime.datetime[source]
-
erepublik.utils.normalize_html_json(js: str) → str[source]
-
erepublik.utils.now() → datetime.datetime[source]
-
erepublik.utils.silent_sleep()
sleep(seconds)
Delay execution for a given number of seconds. The argument may be
a floating point number for subsecond precision.
-
erepublik.utils.slugify(value, allow_unicode=False) → str[source]
Function copied from Django2.2.1 django.utils.text.slugify
Convert to ASCII if ‘allow_unicode’ is False. Convert spaces to hyphens.
Remove characters that aren’t alphanumerics, underscores, or hyphens.
Convert to lowercase. Also strip leading and trailing whitespace.
-
erepublik.utils.write_file(filename: str, content: str) → int[source]
Module contents
Top-level package for eRepublik script.
-
class erepublik.Citizen(*args, **kwargs)[source]
Bases: erepublik.citizen._Citizen
-
property as_dict
-
buy_market_offer(offer: erepublik.classes.OfferItem, amount: Optional[int] = None) → Optional[Dict[str, Any]][source]
-
set_locks()[source]
-
update_companies()[source]
-
update_inventory()[source]
Updates citizen inventory
-
update_job_info()[source]
-
update_money(page: int = 0, currency: int = 62)[source]
Gets monetary market offers to get exact amount of CC and Gold available
-
update_weekly_challenge()[source]