Skip to content
This repository was archived by the owner on Nov 4, 2025. It is now read-only.
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ api.send_electrocounters(flat_id, new_values)
```
### Получить епд
```
epd = api.get_epd(flat_id, period, is_debit)
epd = api.get_epd(flat_id, begin_period, end_period)
```
### Получить штрафы
```
Expand Down
15 changes: 6 additions & 9 deletions emp_mos_api/examples/read_electro_epd.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,12 @@
print('Счет электро: ', f['electro_account'])
print('Счетчик электро: ', f['electro_device'])

for x in range (1,13):
date = '10.{}.2018'.format(x)
epd = api.get_epd(f['flat_id'], date, False)
if epd == []:
epd = api.get_epd(f['flat_id'], date, False)
epd_total = epd[0]['amount']
epd_is_paid = epd[0]['is_paid']
print(" - Дата: {}, сумма: {}, оплачен: {}.".format(date, epd_total, epd_is_paid))
time.sleep(1)
epds = api.get_epd(f['flat_id'], '01.01.2018', '31.12.2018')
for epd in epds:
period = epd['period']
epd_total = epd['amount']
epd_is_paid = epd['payment_status'] == 'PAID'
print(" - Дата: {}, сумма: {}, оплачен: {}.".format(period, epd_total, epd_is_paid))

if f['electro_account'] != "":
electro = api.get_electrocounters(f['flat_id'])
Expand Down
34 changes: 20 additions & 14 deletions emp_mos_api/mos.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

API_V1_0 = 'https://emp.mos.ru/v1.0'
API_V1_1 = 'https://emp.mos.ru/v1.1'

API_V1_2 = 'https://emp.mos.ru/v1.2'

class AuthException(Exception):
pass
Expand Down Expand Up @@ -579,21 +579,27 @@ def send_electrocounters(self, flat_id, counters_data):
self.raise_for_status(response)
return response['result']

def get_epd(self, flat_id, period, is_debt=True):
def get_epd(self, flat_id, begin_period, end_period):
"""
:param flat_id: unicode string from flat_response
response[0]['flat_id']
:param period: unicode string represents date in 27.09.2018 format
:param is_debt: True/False
:return:
{
"is_debt": true,
"is_paid": true,
"amount": 2982.77,
"service_code": "emp.zkh",
"insurance": 61.93,
"ammount_insurance": 3044.7
}
:return: array of
[{
"uin": "234234234234234234234234",
"insurance_amount": null,
"period": "01.12.2021",
"epd_type": "REGULAR",
"payment_amount": "3316,73",
"payment_date": "01.12.2021",
"payment_status": "PAID",
"initiator": "MFC",
"create_date": "11.12.2021 19:34",
"penalty_amount": "0,00",
"amount": "3316,73",
"amount_with_insurance": null
}]
"""
assert self.session_id
wheaders = deepcopy(self.headers)
Expand All @@ -605,11 +611,11 @@ def get_epd(self, flat_id, period, is_debt=True):
wcrequest = deepcopy(self.post_request_data)
wcrequest.update({
'flat_id': flat_id,
'period': period,
'is_debt': is_debt,
'begin_period': begin_period,
'end_period': end_period
})

ret = self.session.post(API_V1_1 + '/epd/get',
ret = self.session.post(API_V1_2 + '/epd/get',
params={'token': self.token},
headers=wheaders,
verify=self.verify,
Expand Down