Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Evgenij-evso opened this issue Apr 1, 2024 · 2 comments

Comments

@Evgenij-evso
Copy link

@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
Copy link

andron23 commented Apr 3, 2024

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

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

@Evgenij-evso
Copy link
Author

Evgenij-evso commented Apr 8, 2024

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

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!"})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants