|
|
|
|
@ -5,8 +5,8 @@ from max_bot.models import Client
|
|
|
|
|
from restoran_max_bot.common import common_get_menu, common_get_data
|
|
|
|
|
from restoran_max_bot.settings import DEBUG
|
|
|
|
|
|
|
|
|
|
url_max = "https://platform-api.max.ru"
|
|
|
|
|
|
|
|
|
|
url_max = "https://platform-api2.max.ru"
|
|
|
|
|
max_verify = False
|
|
|
|
|
|
|
|
|
|
def maxbot_send_text_message(chat_id: str, max_token: str, message: str):
|
|
|
|
|
url = f"{url_max}/messages?chat_id={chat_id}"
|
|
|
|
|
@ -20,7 +20,7 @@ def maxbot_send_text_message(chat_id: str, max_token: str, message: str):
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
@ -42,7 +42,7 @@ def maxbot_send_img_message(chat_id: str, max_token: str, message: str, img: str
|
|
|
|
|
'Authorization': f'{max_token}',
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
@ -89,7 +89,7 @@ def maxbot_send_menu_button(client: Client, chat_id: str, max_token: str, messag
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
@ -103,7 +103,7 @@ def maxbot_get_all_messages(chat_id: str, max_token: str):
|
|
|
|
|
'Authorization': f'{max_token}',
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
response = requests.request("GET", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("GET", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response.json()}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
@ -117,7 +117,7 @@ def maxbot_del_messages(max_token: str, message_id: str):
|
|
|
|
|
'Authorization': f'{max_token}',
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
response = requests.request("DELETE", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("DELETE", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response.json()}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
@ -155,7 +155,7 @@ def maxbot_get_phone(chat_id: str, max_token: str, text: str):
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
@ -195,7 +195,7 @@ def maxbot_send_day_button(client: Client, chat_id: str, max_token: str, message
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
@ -239,7 +239,7 @@ def maxbot_send_month_button(client: Client, chat_id: str, max_token: str, messa
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
@ -292,7 +292,7 @@ def maxbot_send_feedback_button(client: Client, chat_id: str, max_token: str, me
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
@ -333,7 +333,7 @@ def maxbot_send_booking_count_people_button(client: Client, chat_id: str, max_to
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
@ -366,5 +366,5 @@ def maxbot_send_link_button(text, title_button, link, chat_id, max_token):
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload, verify=max_verify)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|