Получение данных из 1С через brom
Всем привет! Возникла проблема при получении видов номенклатур через расширение Brom на Python
Вот мой код:
from brom import *
клиент = БромКлиент(
публикация="http://localhost/BROM",
пользователь="brom",
пароль=""
)
клиент.Справочники.ВидыНоменклатуры.НайтиПоНименованию("Товары")
Вот ошибка:
{
"name": "TransportError",
"message": "Server returned response (400) with invalid XML: Invalid XML content received (Start tag expected, '<' not found, line 1, column 1).
Content: b'\\xef\\xbb\\xbf{\"#exception\":\"{http://v8.1c.ru/8.1/data/core}Exception\",\"exception\":{\"clsid\":\"a01f465c-ed70-442e-ada5-847668d7a41c\",\"descr\":\"\\xd0\\x94\\xd0\\xbe\\xd1\\x81\\xd1\\x82\\xd0\\xb8\\xd0\\xb3\\xd0\\xbd\\xd1\\x83\\xd1\\x82\\xd0\\xbe \\xd0\\xbe\\xd0\\xb3\\xd1\\x80\\xd0\\xb0\\xd0\\xbd\\xd0\\xb8\\xd1\\x87\\xd0\\xb5\\xd0\\xbd\\xd0\\xb8\\xd0\\xb5 \\xd1\\x83\\xd1\\x87\\xd0\\xb5\\xd0\\xb1\\xd0\\xbd\\xd0\\xbe\\xd0\\xb9 \\xd0\\xb2\\xd0\\xb5\\xd1\\x80\\xd1\\x81\\xd0\\xb8\\xd0\\xb8\\\
\\xd0\\x94\\xd0\\xbe\\xd1\\x81\\xd1\\x82\\xd0\\xb8\\xd0\\xb3\\xd0\\xbd\\xd1\\x83\\xd1\\x82\\xd0\\xbe \\xd0\\xbf\\xd1\\x80\\xd0\\xb5\\xd0\\xb4\\xd0\\xb5\\xd0\\xbb\\xd1\\x8c\\xd0\\xbd\\xd0\\xbe\\xd0\\xb5 \\xd0\\xba\\xd0\\xbe\\xd0\\xbb\\xd0\\xb8\\xd1\\x87\\xd0\\xb5\\xd1\\x81\\xd1\\x82\\xd0\\xb2\\xd0\\xbe \\xd0\\xbf\\xd0\\xbe\\xd0\\xb4\\xd0\\xba\\xd0\\xbb\\xd1\\x8e\\xd1\\x87\\xd0\\xb5\\x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3QuZGxsOjB4MDAxNThFMzQgdWNydGJhc2UuZGxs\\\\r\\\
OjB4MDAwMDAwMDAgS0VSTkVMMzIuRExMOjB4MDAwMDAwMDAgdW5rbm93bjoweDAw\\\\r\\\
MDAwMDAwIHVua25vd246MHgwMDAwMDAwMCAiLCIwMDAwMDAwMDAwMDAwMDAwMDAw\\\\r\\\
MDAwMDAwIiwwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDB9LDM5\\\\r\\\
fQ==\",\"category\":\"0000000000000000000000000\",\"creationStack\":\"backendt.dll:0x00006DD6 backendt.dll:0x0058C1AE backendt.dll:0x0058ADEF vrsbaset.dll:0x000180B4 vrsbaset.dll:0x00017013 vrsbaset.dll:0x0001671E vrsbaset.dll:0x0011FCFE vrsbaset.dll:0x00120DBE vrsbaset.dll:0x0004DE83 vrsbaset.dll:0x00013083 vrsbaset.dll:0x00056176 vrsbaset.dll:0x0004B209 vrsbaset.dll:0x000564A4 vrsbaset.dll:0x00056E89 core83t.dll:0x0027CA20 core83t.dll:0x0027CA82 core83t.dll:0x00158E34 ucrtbase.dll:0x00000000 KERNEL32.DLL:0x00000000 unknown:0x00000000 unknown:0x00000000 \"}}'",
"stack": "---------------------------------------------------------------------------
XMLSyntaxError Traceback (most recent call last)
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\zeep\\loader.py:50, in parse_xml(content, transport, base_url, settings)
49 try:
---> 50 elementtree = fromstring(content, parser=parser, base_url=base_url)
51 docinfo = elementtree.getroottree().docinfo
File src\\\\lxml\\\\etree.pyx:3307, in lxml.etree.fromstring()
File src\\\\lxml\\\\parser.pxi:1989, in lxml.etree._parseMemoryDocument()
File src\\\\lxml\\\\parser.pxi:1876, in lxml.etree._parseDoc()
File src\\\\lxml\\\\parser.pxi:1164, in lxml.etree._BaseParser._parseDoc()
File src\\\\lxml\\\\parser.pxi:633, in lxml.etree._ParserContext._handleParseResultDoc()
File src\\\\lxml\\\\parser.pxi:743, in lxml.etree._handleParseResult()
File src\\\\lxml\\\\parser.pxi:672, in lxml.etree._raiseParseError()
XMLSyntaxError: Start tag expected, '<' not found, line 1, column 1 (<string>, line 1)
During handling of the above exception, another exception occurred:
XMLSyntaxError Traceback (most recent call last)
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\zeep\\wsdl\\bindings\\soap.py:204, in SoapBinding.process_reply(self, client, operation, response)
203 try:
--> 204 doc = parse_xml(content, self.transport, settings=client.settings)
205 except XMLSyntaxError as exc:
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\zeep\\loader.py:66, in parse_xml(content, transport, base_url, settings)
65 except etree.XMLSyntaxError as exc:
---> 66 raise XMLSyntaxError(
67 \"Invalid XML content received (%s)\" % exc.msg, content=content
68 )
XMLSyntaxError: Invalid XML content received (Start tag expected, '<' not found, line 1, column 1)
During handling of the above exception, another exception occurred:
TransportError Traceback (most recent call last)
Cell In[48], line 1
----> 1 клиент.Справочники.ВидыНоменклатуры.НайтиПоНименованию(\"Товары\")
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\brom.py:3065, in ОбъектыМенеджер.__getattr__(self, item)
3064 def __getattr__(self, item):
-> 3065 return self.__tryget(item)
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\brom.py:3043, in ОбъектыМенеджер.__tryget(self, name)
3042 def __tryget(self, name):
-> 3043 метаданные = self._moduleMetadata.Найти(name)
3044 if метаданные:
3045 if self.__collectionType == ТипКоллекции.Справочник:
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\brom.py:242, in УзелМетаданных.Найти(self, имя)
240 результат = self;
241 for текИмя in имена:
--> 242 узел = результат.НайтиПодчиненный(текИмя)
243 if узел:
244 результат = узел
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\brom.py:870, in МетаданныеКоллекция.НайтиПодчиненный(self, имя)
867 if node != None:
868 return ПостроительМетаданных.ПолучитьУзелИзSOAP(node, self)
--> 870 именаПодчиненных = self.ИменаПодчиненных()
871 for текИмя in именаПодчиненных:
872 if текИмя.lower() == имя.lower():
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\brom.py:846, in МетаданныеКоллекция.ИменаПодчиненных(self)
843 self.__childrenNames = имена
844 return self.__childrenNames
--> 846 картаИмен = self.Корень().ПолучитьИменаОбъектовКоллекций(self.Путь())
847 имена = картаИмен[self.Путь()]
848 if not имена == None:
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\brom.py:998, in МетаданныеКонфигурация.ПолучитьИменаОбъектовКоллекций(self, коллекции)
997 def ПолучитьИменаОбъектовКоллекций(self, коллекции):
--> 998 result = self.__bromClient.SoapКлиент.service.GetMetadaChildrenNames(коллекции)
999 return self.__bromClient.Сериализатор().ИзЗначенияБром(result)
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\zeep\\proxy.py:46, in OperationProxy.__call__(self, *args, **kwargs)
43 if soap_headers:
44 kwargs[\"_soapheaders\"] = soap_headers
---> 46 return self._proxy._binding.send(
47 self._proxy._client,
48 self._proxy._binding_options,
49 self._op_name,
50 args,
51 kwargs,
52 )
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\zeep\\wsdl\\bindings\\soap.py:135, in SoapBinding.send(self, client, options, operation, args, kwargs)
132 if client.settings.raw_response:
133 return response
--> 135 return self.process_reply(client, operation_obj, response)
File c:\\Users\\T\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\zeep\\wsdl\\bindings\\soap.py:206, in SoapBinding.process_reply(self, client, operation, response)
204 doc = parse_xml(content, self.transport, settings=client.settings)
205 except XMLSyntaxError as exc:
--> 206 raise TransportError(
207 \"Server returned response (%s) with invalid XML: %s.\
Content: %r\"
208 % (response.status_code, exc, response.content),
209 status_code=response.status_code,
210 content=response.content,
211 )
213 # Check if this is an XOP message which we need to decode first
214 if message_pack:
TransportError: Server returned response (400) with invalid XML: Invalid XML content received (Start tag expected, '<' not found, line 1, column 1).
Content: b'\\xef\\xbb\\xbf{\"#exception\":\"{http://v8.1c.ru/8.1/data/core}Exception\",\"exception\":{\"clsid\":\"a01f465c-ed70-442e-ada5-847668d7a41c\",\"descr\":\"\\xd0\\x94\\xd0\\xbe\\xd1\\x81\\xd1\\x82\\xd0\\xb8\\xd0\\xb3\\xd0\\xbd\\xd1\\x83\\xd1\\x82\\xd0\\xbe \\xd0\\xbe\\xd0\\xb3\\xd1\\x80\\xd0\\xb0\\xd0\\xbd\\xd0\\xb8\\xd1\\x87\\xd0\\xb5\\xd0\\xbd\\xd0\\xb8\\xd0\\xb5 \\xd1\\x83\\xd1\\x87\\xd0\\xb5\\xd0\\xb1\\xd0\\xbd\\xd0\\xbe\\xd0\\xb9 \\xd0\\xb2\\xd0\\xb5\\xd1\\x80\\xd1\\x81\\xd0\\xb8\\xd0\\xb8\\\
\\xd0\\x94\\xd0\\xbe\\xd1\\x81\\xd1\\x82\\xd0\\xb8\\xd0\\xb3\\xd0\\xbd\\xd1\\x83\\xd1\\x82\\xd0\\xbe \\xd0\\xbf\\xd1\\x80\\xd0\\xb5\\xd0\\xb4\\xd0\\xb5\\xd0\\xbb\\xd1\\x8c\\xd0\\xbd\\xd0\\xbe\\xd0\\xb5 \\xd0\\xba\\xd0\\xbe\\xd0\\xbb\\xd0\\xb8\\xd1\\x87\\xd0\\xb5\\xd1\\x81\\xd1\\x82\\xd0\\xb2\\xd0\\xbe \\xd0\\xbf\\xd0\\xbe\\xd0\\xb4\\xd0\\xba\\xd0\\xbb\\xd1\\x8e\\xd1\\x87\\xd0\\xb5\\xd0\\xbd\\xd0\\xb8\\xd0\\xb9 \\xd0\\xba \\xd0\\x98\\xd0\\x91\",\"data\":\"77u/ew0Ke2EwMWY0NjVjLWVkNzAtNDQyZS1hZ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joweDAw\\\\r\\\
MDAwMDAwIHVua25vd246MHgwMDAwMDAwMCAiLCIwMDAwMDAwMDAwMDAwMDAwMDAw\\\\r\\\
MDAwMDAwIiwwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDB9LDM5\\\\r\\\
fQ==\",\"category\":\"0000000000000000000000000\",\"creationStack\":\"backendt.dll:0x00006DD6 backendt.dll:0x0058C1AE backendt.dll:0x0058ADEF vrsbaset.dll:0x000180B4 vrsbaset.dll:0x00017013 vrsbaset.dll:0x0001671E vrsbaset.dll:0x0011FCFE vrsbaset.dll:0x00120DBE vrsbaset.dll:0x0004DE83 vrsbaset.dll:0x00013083 vrsbaset.dll:0x00056176 vrsbaset.dll:0x0004B209 vrsbaset.dll:0x000564A4 vrsbaset.dll:0x00056E89 core83t.dll:0x0027CA20 core83t.dll:0x0027CA82 core83t.dll:0x00158E34 ucrtbase.dll:0x00000000 KERNEL32.DLL:0x00000000 unknown:0x00000000 unknown:0x00000000 \"}}'"
}