Нужно переписать пример php ф-ции на python ф-цию или пример POST запроса через curl в CLI:
public function addDeal($data): void
{
$httpClient = new HttpClient();
$httpClient->post( $this->url . '/crm.deal.add', [
'fields' => [
'CATEGORY_ID' => '12345',
'TITLE' => 'My Name',
'CONTACT_ID' => '3456456',
'SOURCE_ID' => 'WEB',
'UF_CRM_1542573179992' => 'Test',
],
] );
}
-
import requests
url = "http://xxxxxx.xxx"
params= {
'CATEGORY_ID': '12345',
'TITLE': 'My Name',
'CONTACT_ID': '3456456',
'SOURCE_ID': 'WEB',
'UF_CRM_1542573179992': 'Test'
}
r = requests.post(url+"/crm.deal.add", data=params) -
Pavel Loba RockTape Ukraine
Так пробовал, не работает. Теряется вложенность в
'fields'
Также пробовал тело запроса писать вот так:
data = {
"fields": [{"TITLE": "Иванов Иван 01.01.2018"}]
};
А вот вариант на php в примере работает. Но я не понимаю, как его адаптировать на python.
-
тогда так, если все параметры должны быть внутри fields:
import requests
url = "http://xxxxxx.xxx"
params = {
'fields': {
'CATEGORY_ID': '12345',
'TITLE': 'My Name',
'CONTACT_ID': '3456456',
'SOURCE_ID': 'WEB',
'UF_CRM_1542573179992': 'Test'
}
}
r = requests.post(url+"/crm.deal.add", data=params) -
Current freelance projects in the category PHP
Development of 2 SEO-oriented websites for selling spare parts (ATVs and special equipment)Development of Two Specialized Websites for Selling Spare PartsGeneral Information It is necessary to develop two specialized websites: Spare parts for ATVs, UTVs, SSVs, and other similar equipment. Spare parts for special equipment. Existing company website:… PHP, Web Programming ∙ 2 hours 34 minutes back ∙ 28 proposals |
Improvement of the Bropack website on WordPress (layout adjustments, form settings, and SEO)Task Description:We are looking for an experienced WordPress developer/front-end developer to promptly complete the project https://bropack.com.ua/. The site has already been designed and set up on WordPress, but due to the previous contractor missing deadlines, it is necessary… HTML & CSS, PHP ∙ 3 hours 40 minutes back ∙ 15 proposals |
Looking for a white-label solution for a betting company for rent. |
Development of a WordPress website
23 USD
We are looking for a contractor to develop a custom website on WordPress for a jewelry store. The first stage will be a consultation. Content Management Systems, PHP ∙ 2 days 18 hours back ∙ 67 proposals |
The WooCommerce cart (WordPress) is broken — it does not add products and the cart page does not open.On the website of the online store https://www.dobryi-gospodar.com/ (WordPress + WooCommerce), the checkout function has completely stopped working. When clicking the "Add to cart" button (both in the product card and in the catalog), a long loading process begins (the indicator… Content Management Systems, PHP ∙ 2 days 20 hours back ∙ 60 proposals |