Krukov / amocrm_api

Python amocrm API wrapper
MIT License
104 stars 55 forks source link

Не работает lead.notes.objects.create(text="Примечание") и lead.notes(text="Примечание").save() #119

Open Evgenij-evso opened 8 months ago

Evgenij-evso commented 8 months ago

@Krukov Не работает не lead.notes.objects.create(text="Примечание") не lead.notes(text="Примечание").save()

lead = Lead() lead.name = "ТЕСТОВЫЙ ЗАПРОС" lead.notes(text = 'Примечание').save()

так выдает - ошибку

Traceback (most recent call last): File "c:\Progect\cooleso.ru_bot\testamo.py", line 35, in lead.notes(text = 'Сообщение').save() File "C:\Users\Евгений\AppData\Local\Programs\Python\Python39\lib\site-packages\amocrm\v2\model.py", line 51, in save
self.create() File "C:\Users\Евгений\AppData\Local\Programs\Python\Python39\lib\site-packages\amocrm\v2\model.py", line 59, in create self._data["id"] = self._manager.create(self._data).id File "C:\Users\Евгений\AppData\Local\Programs\Python\Python39\lib\site-packages\amocrm\v2\manager.py", line 16, in create return self._model(data=self._interaction.create(data=data or kwargs)) File "C:\Users\Евгений\AppData\Local\Programs\Python\Python39\lib\site-packages\amocrm\v2\interaction.py", line 123, in create response, status = self.request("post", self._get_path(), data=[data]) File "C:\Users\Евгений\AppData\Local\Programs\Python\Python39\lib\site-packages\amocrm\v2\interaction.py", line 57, in request return self._request(method, path, data=data, params=params, headers=headers) File "C:\Users\Евгений\AppData\Local\Programs\Python\Python39\lib\site-packages\amocrm\v2\interaction.py", line 51, in _request raise exceptions.AmoApiException("Wrong status {} ({})".format(response.status_code, response.text)) amocrm.v2.exceptions.AmoApiException: Wrong status 404 ({"title":"Not Found","type":"https://httpstatus.es/404","status":404,"detail":"Cannot POST https://autoschoolkoleso.amocrm.ru/leads/None/notes!"})

а если так

lead = Lead() lead.name = "ТЕСТОВЫЙ ЗАПРОС" lead.notes(text = 'Примечание') lead.save()

то примечание просто не появляется

Ваще не понимаю почему так происходит((

andron23 commented 8 months ago

Возможно вам поможет - мы вот так создаем примечание:

# Здесь our_lead - объект какой-то сделки
our_lead.notes.objects.create(
    note_type="common",
    text="Текст примечания",
)
Evgenij-evso commented 8 months ago

Неа, не работает выдает ошибку -

File "c:\Progect\cooleso.ru_bot\py\testamo.py", line 36, in lead.notes.objects.create( File "C:\Users\Евгений\AppData\Local\Programs\Python\Python39\lib\site-packages\amocrm\v2\manager.py", line 16, in create return self._model(data=self._interaction.create(data=data or kwargs)) File "C:\Users\Евгений\AppData\Local\Programs\Python\Python39\lib\site-packages\amocrm\v2\interaction.py", line 123, in create response, status = self.request("post", self._get_path(), data=[data]) File "C:\Users\Евгений\AppData\Local\Programs\Python\Python39\lib\site-packages\amocrm\v2\interaction.py", line 57, in request return self._request(method, path, data=data, params=params, headers=headers) File "C:\Users\Евгений\AppData\Local\Programs\Python\Python39\lib\site-packages\amocrm\v2\interaction.py", line 51, in _request raise exceptions.AmoApiException("Wrong status {} ({})".format(response.status_code, response.text)) amocrm.v2.exceptions.AmoApiException: Wrong status 404 ({"title":"Not Found","type":"https://httpstatus.es/404","status":404,"detail":"Cannot POST https://autoschoolkoleso.amocrm.ru/leads/None/notes!"})