diff --git a/data/.DS_Store b/data/.DS_Store new file mode 100644 index 0000000..6a3f1a3 Binary files /dev/null and b/data/.DS_Store differ diff --git a/data/domreshetnikovo@gmail.com/.DS_Store b/data/domreshetnikovo@gmail.com/.DS_Store new file mode 100644 index 0000000..79b9d18 Binary files /dev/null and b/data/domreshetnikovo@gmail.com/.DS_Store differ diff --git a/data/domreshetnikovo@gmail.com/6/.DS_Store b/data/domreshetnikovo@gmail.com/6/.DS_Store new file mode 100644 index 0000000..5cb639d Binary files /dev/null and b/data/domreshetnikovo@gmail.com/6/.DS_Store differ diff --git a/data/osa212@mail.ru/.DS_Store b/data/osa212@mail.ru/.DS_Store new file mode 100644 index 0000000..79b9d18 Binary files /dev/null and b/data/osa212@mail.ru/.DS_Store differ diff --git a/data/osa212@mail.ru/6/.DS_Store b/data/osa212@mail.ru/6/.DS_Store new file mode 100644 index 0000000..3d885ca Binary files /dev/null and b/data/osa212@mail.ru/6/.DS_Store differ diff --git a/knd_bot.py b/knd_bot.py index 0a7e37c..2af28b9 100644 --- a/knd_bot.py +++ b/knd_bot.py @@ -14,24 +14,6 @@ from classes.users import Users -# anwer_text = '{"question_chains":[{"id":6145,"questions":[{"id":6559,"question_components":[]}]},{"id":6147,"questions":[{"id":6561,"question_components":[]}]},{"id":6147,"questions":[{"id":6561,"question_components":[]}]},{"id":6147,"questions":[{"id":6561,"question_components":[]}]},{"id":6147,"questions":[{"id":6561,"question_components":[]}]}]}' - -# question_text = '' - - -#def get_enterance_and_coord(session, headers, execution_id): -# photo_id = send_image(session, headers, execution_id) -# pass - - -def send_execution(task, session, headers): - # answers_for_data = [{"id":6145,"questions":[{"id":6559,"question_components":[{"id":18850,"answer":[80634165],"answer_status":null,"end_time":1591866979,"start_time":1591866978},{"id":18851,"answer":{"location":[56.439337,36.557897]},"answer_status":null,"start_time":1591866873,"end_time":1591867165}]}]}] - # print(task) - # print(time.ctime(1592235230)) - string1 = '{"id":6145,"questions":[{"id":6559,"question_components":[{"id":18850,"answer":[80634165],"answer_status":null,"end_time":1591866979,"start_time":1591866978},{"id":18851,"answer":{"location":[56.439337,36.557897]},"answer_status":null,"start_time":1591866873,"end_time":1591867165},{"id":18852,"answer":"1","answer_status":null,"start_time":1591867063,"end_time":1591867063}]}]}' -# get_questions(task.get('id'), session, headers) - print(json.dumps(json.loads(string1), indent=4)) - def get_questions(id_task, session, headers): @@ -47,11 +29,9 @@ def send_image(session, headers, url, photo): files = { 'image': (photo[-5:], open(photo, 'rb')), } + print(photo) img = session.post('https://knd.mosreg.ru//api/v1/executions/'+str(url)+'/images', headers=headers, files=files) return img.json() - # print(img.headers) - # print(img.text) - # print(img.status_code) def complete_task(session, headers, task, address): @@ -79,7 +59,6 @@ def complete_task(session, headers, task, address): answer_chain.update({'questions': comp}) data.append(answer_chain) if len(data) == len(photos): - print('1') for chain in data: for item in chain['questions']: if len(data) == len(photos): @@ -112,8 +91,6 @@ def get_photo(address, email): for images in os.listdir(main_path): photos.append(main_path + '/' + images) return photos - - def get_addresses(email): @@ -162,7 +139,7 @@ def get_task(session, headers): ) for address in addresses: # need split enterance from address - search = 'Майданово п, Радищева ул, 73'#address[:-4] + search = address[:-4] print(search) data = {'search': search} tasks = session_t.post('https://knd.mosreg.ru//api/v1/executions', @@ -213,16 +190,16 @@ def main(): 'uid': response.headers.get('uid'), } if response.status_code == 200: - task = { - 'id': 23607882, - 'address': 'Решетниково рп, ОПМС-1 проезд, 13', - 'enterance': 6, - 'coord': [56.442503, 36.5596493] - } - address = 'Решетниково рп, ОПМС-1 проезд, 13, 6п' - assign_task(session, headers, task, address) - break - # get_task(session, headers) + # task = { + # 'id': 23607882, + # 'address': 'Решетниково рп, ОПМС-1 проезд, 13', + # 'enterance': 6, + # 'coord': [56.442503, 36.5596493] + # } + # address = 'Решетниково рп, ОПМС-1 проезд, 13, 6п' + # assign_task(session, headers, task, address) + # break + get_task(session, headers) else: print(f"Отказ в авторизации для пользователя {user['email']}!") time.sleep(1)