F
F
fractori2018-09-07 00:50:23
Python
fractori, 2018-09-07 00:50:23

How to extract text from bitrix24 using Python?

Good day!
The essence of the question is to display in a text document the addresses of the Transactions, in the body of which (in the "Comment" block) a line is mentioned, for example, "Make an original cliché".
The algorithm in my view looks like this:
Actually, Transactions in Bitrix go linearly (only the serial number changes in the address line, which goes sequentially).
The program changes only 2 values ​​in two lines with addresses. These are transaction numbers.
Let's say from 12000 to 12700 - the search takes place in this range.
If, when opening a page with a deal, and subsequent search, the condition "Make an original cliché" is met, then the address of this page is saved in a notepad. Then the cycle repeats until it reaches 12700.

spoiler
P.S: я сдался на первой строчке "webbrowser.open ( )"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene Pedya, 2018-09-07
@fpinger

Bitrix 24 has a REST API. And with him do not care what to work on. But you need to know what you are working on.
Let's log in.
We make requests for transactions.
We do what we need with deals.

L
leshchenko, 2020-08-05
@leshchenko

1. Create a webhook in Bitrix24: Applications -> More -> Webhooks
2. Use the fast_bitrix24 package to access the Bitrix24 REST API.
pip install fast_bitrix24
3. Write in Python:

from fast_bitrix24 import Bitrix
b = Bitrix('адрес вашего вебхука')
deals = b.get_all('crm.deal.list')
comments = b.get_by_ID('crm.deal.comment.items.get', 
    [d['ID'] for d in deals])

You get a tuple where each element has the form
(deal ID, [{comment properties 1}, {comment properties 2},....])
In this list, you can find the comments and deals you are interested in:
filtered_deal_IDs = []
for deal_id, deal_comments in comments:
    if "Изготовить оригинальное клише" in [c['TITLE'] for c in deal_comments]:
        filtered_deal_ID.append(deal_id)

Now your `filtered_deal_IDs` contains a list of IDs of the deals you are looking for.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question