Best Python code snippet using playwright-python
custom_fields.py
Source: custom_fields.py
1"""2ID и опиÑÐ°Ð½Ð¸Ñ Ð´Ð¾Ð¿Ð¾Ð»Ð½Ð¸ÑелÑнÑÑ
полей3"""4AMOCRM_FIELDS = {5 "contacts": {6 "127489": {7 "id": 127489,8 "name": "ÐолжноÑÑÑ",9 "field_type": 1,10 "sort": 7,11 "code": "POSITION",12 "is_multiple": False,13 "is_system": True,14 "is_editable": True,15 "is_required": False,16 "is_deletable": True,17 "is_visible": True,18 "params": {}19 },20 "127491": {21 "id": 127491,22 "name": "ТелеÑон",23 "field_type": 8,24 "sort": 4,25 "code": "PHONE",26 "is_multiple": True,27 "is_system": True,28 "is_editable": True,29 "is_required": False,30 "is_deletable": True,31 "is_visible": True,32 "params": {},33 "enums": {34 "264231": "WORK",35 "264233": "WORKDD",36 "264235": "MOB",37 "264237": "FAX",38 "264239": "HOME",39 "264241": "OTHER"40 }41 },42 "127493": {43 "id": 127493,44 "name": "Email",45 "field_type": 8,46 "sort": 6,47 "code": "EMAIL",48 "is_multiple": True,49 "is_system": True,50 "is_editable": True,51 "is_required": False,52 "is_deletable": True,53 "is_visible": True,54 "params": {},55 "enums": {56 "264243": "WORK",57 "264245": "PRIV",58 "264247": "OTHER"59 }60 },61 "127497": {62 "id": 127497,63 "name": "Ðгн. ÑообÑениÑ",64 "field_type": 8,65 "sort": 8,66 "code": "IM",67 "is_multiple": True,68 "is_system": True,69 "is_editable": True,70 "is_required": False,71 "is_deletable": True,72 "is_visible": True,73 "params": {},74 "enums": {75 "264249": "SKYPE",76 "264251": "ICQ",77 "264253": "JABBER",78 "264255": "GTALK",79 "264257": "MSN",80 "264259": "OTHER"81 }82 },83 "127829": {84 "id": 127829,85 "name": "CF_NAME_USER_AGREEMENT",86 "field_type": 3,87 "sort": 9,88 "code": "USER_AGREEMENT",89 "is_multiple": False,90 "is_system": True,91 "is_editable": False,92 "is_required": False,93 "is_deletable": True,94 "is_visible": True,95 "params": {}96 },97 "334163": {98 "id": 334163,99 "name": "Instagram",100 "field_type": 7,101 "sort": 506,102 "code": "",103 "is_multiple": False,104 "is_system": False,105 "is_editable": True,106 "is_required": False,107 "is_deletable": True,108 "is_visible": True,109 "params": {}110 },111 "384813": {112 "id": 384813,113 "name": "ÐдÑÐµÑ Ð´Ð¾ÑÑавки",114 "field_type": 7,115 "sort": 504,116 "code": "",117 "is_multiple": False,118 "is_system": False,119 "is_editable": True,120 "is_required": False,121 "is_deletable": True,122 "is_visible": True,123 "params": {}124 },125 "401761": {126 "id": 401761,127 "name": "ÐÑимеÑание",128 "field_type": 1,129 "sort": 505,130 "code": "",131 "is_multiple": False,132 "is_system": False,133 "is_editable": True,134 "is_required": False,135 "is_deletable": True,136 "is_visible": True,137 "params": {}138 },139 "443463": {140 "id": 443463,141 "name": "ÐозÑаÑÑ",142 "field_type": 2,143 "sort": 503,144 "code": "",145 "is_multiple": False,146 "is_system": False,147 "is_editable": True,148 "is_required": False,149 "is_deletable": True,150 "is_visible": True,151 "params": {}152 },153 "480381": {154 "id": 480381,155 "name": "ФоÑо до",156 "field_type": 7,157 "sort": 510,158 "code": "",159 "is_multiple": False,160 "is_system": False,161 "is_editable": True,162 "is_required": False,163 "is_deletable": True,164 "is_visible": True,165 "params": {}166 },167 "480591": {168 "id": 480591,169 "name": "ФоÑо поÑле",170 "field_type": 7,171 "sort": 511,172 "code": "",173 "is_multiple": False,174 "is_system": False,175 "is_editable": True,176 "is_required": False,177 "is_deletable": True,178 "is_visible": True,179 "params": {}180 }181 },182 "leads": {183 "384803": {184 "id": 384803,185 "name": "Регион клиенÑа",186 "field_type": 4,187 "sort": 502,188 "code": "",189 "is_multiple": False,190 "is_system": False,191 "is_editable": True,192 "is_required": False,193 "is_deletable": True,194 "is_visible": True,195 "params": {},196 "enums": {197 "745009": "ÐдÑгеÑ",198 "745011": "ÐлÑайÑкий кÑай",199 "745013": "ÐмÑÑÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",200 "745015": "ÐÑÑ
ангелÑÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",201 "745017": "ÐÑÑÑаÑ
анÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",202 "745019": "ÐаÑкоÑÑоÑÑан",203 "745021": "ÐелгоÑодÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",204 "745023": "ÐÑÑнÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",205 "745025": "ÐÑÑÑÑÐ¸Ñ Ð ÐµÑпÑблика",206 "745027": "ÐладимиÑÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",207 "745029": "ÐолгогÑадÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",208 "745031": "ÐологодÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",209 "745033": "ÐоÑонежÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",210 "745035": "ÐагеÑÑан",211 "745037": "ÐвÑейÑÐºÐ°Ñ ÐÐ",212 "745039": "ÐвановÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",213 "745041": "ÐнгÑÑеÑиÑ",214 "745043": "ÐÑкÑÑÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",215 "745045": "ÐабаÑдино-ÐалкаÑиÑ",216 "745047": "ÐалинингÑадÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",217 "745049": "ÐалмÑкиÑ",218 "745051": "ÐалÑжÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",219 "745053": "ÐамÑаÑка",220 "745055": "ÐаÑаÑаево-ЧеÑкеÑÑиÑ",221 "745057": "ÐаÑелиÑ",222 "745059": "ÐемеÑовÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",223 "745061": "ÐиÑовÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",224 "745063": "Ðоми РеÑпÑблика",225 "745065": "Ðоми-ÐеÑмÑÑкий ÐÐ",226 "745067": "ÐоÑÑÑомÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",227 "745069": "ÐÑаÑнодаÑÑкий кÑай",228 "745071": "ÐÑаÑноÑÑÑкий кÑай",229 "745073": "ÐÑÑганÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",230 "745075": "ÐÑÑÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",231 "745077": "ÐенингÑадÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",232 "745079": "ÐипеÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",233 "745081": "ÐагаданÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",234 "745083": "ÐаÑи-Ðл",235 "745085": "ÐоÑдовиÑ",236 "745087": "ÐоÑковÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",237 "745089": "ÐÑÑманÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",238 "745091": "ÐижегоÑодÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",239 "745093": "ÐовгоÑодÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",240 "745095": "ÐовоÑибиÑÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",241 "745097": "ÐмÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",242 "745099": "ÐÑенбÑÑгÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",243 "745101": "ÐÑловÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",244 "745103": "ÐензенÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",245 "745105": "ÐеÑмÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",246 "745107": "ÐÑимоÑÑкий кÑай",247 "745109": "ÐÑковÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",248 "745111": "РоÑÑовÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",249 "745113": "Ð ÑзанÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",250 "745115": "СамаÑÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",251 "745117": "СаÑаÑовÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",252 "745119": "СаÑ
алин",253 "745121": "СвеÑдловÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",254 "745123": "СевеÑÐ½Ð°Ñ ÐÑеÑиÑ",255 "745125": "СмоленÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",256 "745127": "СÑавÑополÑÑкий кÑай",257 "745129": "ТаймÑÑ",258 "745131": "ТамбовÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",259 "745133": "ТаÑаÑÑÑан",260 "745135": "ТвеÑÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",261 "745137": "ТомÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",262 "745139": "ТÑва",263 "745141": "ТÑлÑÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",264 "745143": "ТÑменÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",265 "745145": "УдмÑÑÑиÑ",266 "745147": "УлÑÑновÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",267 "745149": "УÑÑÑ-ÐÑдÑнÑкий ÐÐ",268 "745151": "ХабаÑовÑкий кÑай",269 "745153": "ХакаÑÑиÑ",270 "745155": "ХанÑÑ-ÐанÑийÑк",271 "745157": "ЧелÑбинÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",272 "745159": "ЧеÑенÑÐºÐ°Ñ Ð ÐµÑпÑблика",273 "745161": "ЧиÑинÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",274 "745163": "ЧÑваÑÑÐºÐ°Ñ Ð ÐµÑпÑблика",275 "745165": "ЯкÑÑÐ¸Ñ (СаÑ
а)",276 "745167": "Ямало-ÐенеÑкий ÐÐ",277 "745169": "ЯÑоÑлавÑÐºÐ°Ñ Ð¾Ð±Ð»Ð°ÑÑÑ",278 "763601": "РеÑпÑблика ÐÑÑм",279 "823301": "ÐазаÑ
ÑÑан",280 "823303": "УкÑаина",281 "823305": "ÐелаÑÑÑÑ"282 }283 },284 "384805": {285 "id": 384805,286 "name": "ÐÑÑоÑник лида",287 "field_type": 4,288 "sort": 503,289 "code": "",290 "is_multiple": False,291 "is_system": False,292 "is_editable": True,293 "is_required": False,294 "is_deletable": True,295 "is_visible": True,296 "params": {},297 "enums": {298 "745171": "Instagram",299 "745173": "РекомендаÑии",300 "745175": "СайÑ",301 "745177": "Facebook",302 "745179": "ÐконÑакÑе",303 "745181": "Реклама в ЯндекÑе",304 "745183": "YouTube"305 }306 },307 "384807": {308 "id": 384807,309 "name": "ÐнÑеÑÐµÑ ÐºÐ»Ð¸ÐµÐ½Ñа",310 "field_type": 5,311 "sort": 504,312 "code": "",313 "is_multiple": False,314 "is_system": False,315 "is_editable": True,316 "is_required": False,317 "is_deletable": True,318 "is_visible": True,319 "params": {},320 "enums": {321 "745185": "ÐÑÐ¾Ð±Ð»ÐµÐ¼Ð½Ð°Ñ ÐºÐ¾Ð¶Ð°",322 "745187": "СÑÑ
Ð°Ñ ÐºÐ¾Ð¶Ð°",323 "745189": "УÑ
од за глазами",324 "745191": "ÐнÑивозÑаÑÑное",325 "745193": "ÐигменÑаÑиÑ",326 "745195": "РоÑÑ Ð²Ð¾Ð»Ð¾Ñ",327 "745197": "УÑ
од за молодой кожей",328 "745199": "СеÑÐ¸Ñ 25+",329 "745201": "СеÑÐ¸Ñ 35+",330 "745203": "ÐиÑÐ½Ð°Ñ ÐºÐ¾Ð¶Ð°",331 "745205": "ÐнÑиÑелÑлиÑ",332 "745207": "УÑ
од за Ñелом",333 "745209": "Ð ÑбÑÑ Ð¸ ÑÑамÑ",334 "745211": "ÐÑÑон",335 "763603": "ÐодаÑки",336 "881711": "ÐезоÑоллеÑ"337 }338 },339 "384821": {340 "id": 384821,341 "name": "ÐÑзÑв",342 "field_type": 9,343 "sort": 506,344 "code": "",345 "is_multiple": False,346 "is_system": False,347 "is_editable": True,348 "is_required": False,349 "is_deletable": True,350 "is_visible": True,351 "params": {}352 },353 "384823": {354 "id": 384823,355 "name": "ÐÑиÑина оÑказа",356 "field_type": 4,357 "sort": 507,358 "code": "",359 "is_multiple": False,360 "is_system": False,361 "is_editable": True,362 "is_required": False,363 "is_deletable": True,364 "is_visible": True,365 "params": {},366 "enums": {367 "745213": "Ðе ÑÑÑÑоила Ñена",368 "745215": "Ðе ÑÑÑÑоил ÑÑок доÑÑавки",369 "745217": "ÐÐµÑ Ð² налиÑии",370 "745219": "ХоÑÑÑ Ð¿Ð¾ÑмоÑÑеÑÑ Ð¿Ñежде Ñем покÑпаÑÑ",371 "745221": "ÐÑпил в дÑÑгом меÑÑе",372 "745223": "Ðе Ñказал пÑиÑинÑ"373 }374 },375 "384825": {376 "id": 384825,377 "name": "ÐÑказ подÑобно",378 "field_type": 9,379 "sort": 508,380 "code": "",381 "is_multiple": False,382 "is_system": False,383 "is_editable": True,384 "is_required": False,385 "is_deletable": True,386 "is_visible": True,387 "params": {}388 },389 "401573": {390 "id": 401573,391 "name": "Ðнлайн ÑÑеÑ",392 "field_type": 7,393 "sort": 501,394 "code": "",395 "is_multiple": False,396 "is_system": False,397 "is_editable": True,398 "is_required": False,399 "is_deletable": True,400 "is_visible": True,401 "params": {}402 },403 "443333": {404 "id": 443333,405 "name": "ÐÑкÑда Ñзнали",406 "field_type": 5,407 "sort": 505,408 "code": "",409 "is_multiple": False,410 "is_system": False,411 "is_editable": True,412 "is_required": False,413 "is_deletable": True,414 "is_visible": True,415 "params": {},416 "enums": {417 "823241": "Ð¥ÑÑÑег",418 "823243": "РекомендаÑÐ¸Ñ Ð¾Ñ Ð¿Ð¾Ð´ÑÑги/ÑеÑÑÑÑ",419 "823245": "гив",420 "823247": "повÑоÑнÑй заказ",421 "823249": "ÐоÑановна",422 "823251": "ÐкаÑеÑина ШÑейнеÑ",423 "823253": "Ðлена ÐоÑд",424 "823255": "ÐÑиÑÑи (Kristitheone)",425 "823257": "не помнÑ",426 "823259": "Ñоп в инÑÑагÑам//ÑекомендаÑÐ¸Ñ Ð² инÑÑагÑам",427 "828923": "Ð±Ð»Ð¾Ð³Ð³ÐµÑ Ð½Ðµ Ð¿Ð¾Ð¼Ð½Ñ ÐºÑо",428 "875569": "ÐÐ»Ð¾Ð³Ð³ÐµÑ Ð¢Ð¾Ð¼Ð° ÐлÑм"429 }430 },431 "485367": {432 "id": 485367,433 "name": "ÐдÑÐµÑ Ð´Ð¾ÑÑавки",434 "field_type": 1,435 "sort": 510,436 "code": "",437 "is_multiple": False,438 "is_system": False,439 "is_editable": False,440 "is_required": False,441 "is_deletable": True,442 "is_visible": True,443 "params": {}444 },445 "485369": {446 "id": 485369,447 "name": "ÐомменÑаÑий к заказÑ",448 "field_type": 1,449 "sort": 511,450 "code": "",451 "is_multiple": False,452 "is_system": False,453 "is_editable": False,454 "is_required": False,455 "is_deletable": True,456 "is_visible": True,457 "params": {}458 }459 },460 "companies": {461 "127491": {462 "id": 127491,463 "name": "ТелеÑон",464 "field_type": 8,465 "sort": 4,466 "code": "PHONE",467 "is_multiple": True,468 "is_system": True,469 "is_editable": True,470 "is_required": False,471 "is_deletable": True,472 "is_visible": True,473 "params": {},474 "enums": {475 "264231": "WORK",476 "264233": "WORKDD",477 "264235": "MOB",478 "264237": "FAX",479 "264239": "HOME",480 "264241": "OTHER"481 }482 },483 "127493": {484 "id": 127493,485 "name": "Email",486 "field_type": 8,487 "sort": 6,488 "code": "EMAIL",489 "is_multiple": True,490 "is_system": True,491 "is_editable": True,492 "is_required": False,493 "is_deletable": True,494 "is_visible": True,495 "params": {},496 "enums": {497 "264243": "WORK",498 "264245": "PRIV",499 "264247": "OTHER"500 }501 },502 "127495": {503 "id": 127495,504 "name": "Web",505 "field_type": 7,506 "sort": 8,507 "code": "WEB",508 "is_multiple": False,509 "is_system": True,510 "is_editable": True,511 "is_required": False,512 "is_deletable": True,513 "is_visible": True,514 "params": {}515 },516 "127499": {517 "id": 127499,518 "name": "ÐдÑеÑ",519 "field_type": 9,520 "sort": 12,521 "code": "ADDRESS",522 "is_multiple": False,523 "is_system": True,524 "is_editable": True,525 "is_required": False,526 "is_deletable": True,527 "is_visible": True,528 "params": {}529 }530 },531 "customers": [],532 "catalogs": {533 "4987": {534 "438391": {535 "id": 438391,536 "name": "ÐÑÑикÑл",537 "field_type": 1,538 "sort": 0,539 "code": "SKU",540 "is_multiple": False,541 "is_system": True,542 "is_editable": True,543 "is_required": False,544 "is_deletable": False,545 "is_visible": True,546 "params": {}547 },548 "438393": {549 "id": 438393,550 "name": "ÐпиÑание",551 "field_type": 9,552 "sort": 3,553 "code": "DESCRIPTION",554 "is_multiple": False,555 "is_system": True,556 "is_editable": True,557 "is_required": False,558 "is_deletable": False,559 "is_visible": True,560 "params": {}561 },562 "438395": {563 "id": 438395,564 "name": "Цена",565 "field_type": 2,566 "sort": 2,567 "code": "PRICE",568 "is_multiple": False,569 "is_system": True,570 "is_editable": True,571 "is_required": False,572 "is_deletable": False,573 "is_visible": True,574 "params": {}575 },576 "438397": {577 "id":578 438397,579 "name":580 "ÐÑÑппа",581 "field_type":582 18,583 "sort":584 1,585 "code":586 "GROUP",587 "is_multiple":588 False,589 "is_system":590 True,591 "is_editable":592 True,593 "is_required":594 False,595 "is_deletable":596 False,597 "is_visible":598 True,599 "params": {},600 "enums": {601 "587": "ÐÑÑгое",602 "595": "УмÑвание",603 "597": "ÐолоÑÑ",604 "599": "ТонизиÑование",605 "601": "ÐÑемÑ",606 "603": "Ðлаза",607 "605": "ÐÑÑон",608 "607": "ÐигменÑаÑиÑ",609 "729": "ÐаÑки",610 "899": "СÑвоÑоÑки",611 "901": "Ðилинги"612 },613 "values_tree": [{614 "id": 587,615 "value": "ÐÑÑгое",616 "depth": 0617 }, {618 "id": 595,619 "value": "УмÑвание",620 "depth": 0621 }, {622 "id": 597,623 "value": "ÐолоÑÑ",624 "depth": 0625 }, {626 "id": 599,627 "value": "ТонизиÑование",628 "depth": 0629 }, {630 "id": 601,631 "value": "ÐÑемÑ",632 "depth": 0633 }, {634 "id": 603,635 "value": "Ðлаза",636 "depth": 0637 }, {638 "id": 605,639 "value": "ÐÑÑон",640 "depth": 0641 }, {642 "id": 607,643 "value": "ÐигменÑаÑиÑ",644 "depth": 0645 }, {646 "id": 729,647 "value": "ÐаÑки",648 "depth": 0649 }, {650 "id": 899,651 "value": "СÑвоÑоÑки",652 "depth": 0653 }, {654 "id": 901,655 "value": "Ðилинги",656 "depth": 0657 }]658 },659 "438399": {660 "id": 438399,661 "name": "This is set",662 "field_type": 3,663 "sort": 14,664 "code": "IS_SET",665 "is_multiple": False,666 "is_system": True,667 "is_editable": True,668 "is_required": False,669 "is_deletable": False,670 "is_visible": False,671 "params": {}672 },673 "438401": {674 "id": 438401,675 "name": "External ID",676 "field_type": 1,677 "sort": 15,678 "code": "EXTERNAL_ID",679 "is_multiple": False,680 "is_system": True,681 "is_editable": True,682 "is_required": False,683 "is_deletable": False,684 "is_visible": False,685 "params": {}686 }687 }688 }689}690def get_field_id(cat_name, code):691 """692 ÐолÑÑение id Ð¿Ð¾Ð»Ñ Ð¿Ð¾ его ÐºÐ¾Ð´Ñ Ð¸Ð»Ð¸ названиÑ693 :param cat_name: именование Ñипа обÑекÑа (contacts, leads, companies, etc)694 :param code: код или наименование полÑ695 :return: id полÑ696 """697 for cat, fields in AMOCRM_FIELDS.items():698 if cat == cat_name:699 if cat != 'catalogs':700 if isinstance(fields, dict):701 for item_id, item in fields.items():702 if code in (item['name'], item['code']):703 return item_id704 else:705 for _, cat_items in fields.items():706 for item_id, item in cat_items.items():707 if code in (item['name'], item['code']):708 return item_id...
config_setting_model.py
Source: config_setting_model.py
1# -*- coding: utf-8 -*-2"""ConfigSetting model."""3import datetime as dt4from chaos_genius.databases.base_model import Column, PkModel, db5class ConfigSetting(PkModel):6 """A ConfigSetting."""7 __tablename__ = "config_setting"8 name = Column(db.String(80), nullable=False)9 config_setting = Column(db.JSON)10 active = Column(db.Boolean(), default=True)11 created_at = Column(db.DateTime, nullable=False, default=dt.datetime.utcnow)12 def __init__(self, name, **kwargs):13 """Create instance."""14 super().__init__(name=name, **kwargs)15 def __repr__(self):16 """Represent instance as a unique string."""17 return f"<ConfigSetting({self.name})>"18 @property19 def safe_dict(self):20 return {21 "id": self.id,22 "name": self.name,23 "config_setting": self.config_setting,24 "active": self.active,25 "created_at": self.created_at,26 }27 @property28 def as_dict(self):29 return {30 "id": self.id,31 "name": self.name,32 "config_setting": self.config_setting,33 "active": self.active,34 "created_at": self.created_at,35 }36 @classmethod37 def meta_info(cls):38 # TODO: Make this consistent with other models39 return {40 "slack": {41 "webhook_url": {42 "is_editable": True,43 "is_sensitive": True,44 },45 "channel_name": {46 "is_editable": True,47 "is_sensitive": False,48 }49 },50 "email": {51 "server": {52 "is_editable": True,53 "is_sensitive": False,54 },55 "port": {56 "is_editable": True,57 "is_sensitive": False,58 },59 "username": {60 "is_editable": True,61 "is_sensitive": True,62 },63 "password": {64 "is_editable": True,65 "is_sensitive": True,66 },67 "sender_email": {68 "is_editable": True,69 "is_sensitive": False,70 }71 },72 "organisation_settings": {73 "account": {74 "email": {75 "is_editable": True,76 "is_sensitive": False77 }78 },79 "metrics": {80 "anonymize_usage_data_collection": {81 "is_editable": True,82 "is_sensitive": False83 },84 "news_and_feature_updates": {85 "is_editable": True,86 "is_sensitive": False87 }88 }89 },90 "alert_digest_settings": {91 "active": {92 "is_editable": True,93 "is_sensitive": False94 },95 "daily_digest": {96 "is_editable": True,97 "is_sensitive": False98 },99 "weekly_digest": {100 "is_editable": True,101 "is_sensitive": False102 },103 "scheduled_time": {104 "is_editable": True,105 "is_sensitive": False106 }107 }108 }109 @classmethod110 def get_meta_info(cls, config_name):111 print(cls, config_name)112 if config_name and cls.meta_info().get(config_name):113 return cls.meta_info().get(config_name)114 else:...
default_config.py
Source: default_config.py
1DEFAULT_CONFIG_DICT = {2 'username': {3 "key": "username",4 "name": "username",5 "placeholder": "username",6 "type": 5,7 "username_type": "username",8 "min_length": 4,9 "max_length": 32,10 "is_optional": False,11 "is_editable": False,12 "is_default": True,13 },14 'code': {15 "key": "code",16 "name": "user_id",17 "placeholder": "user_id",18 "type": 5,19 "max_length": 20,20 "is_optional": True,21 "is_editable": False,22 },23 'email': {24 "key": "email",25 "name": "email",26 "placeholder": "email",27 "type": 5,28 "max_length": 100,29 "is_optional": True,30 "is_editable": False,31 },32 'password': {33 "key": "password",34 "name": "password",35 "placeholder": "password",36 "type": 5,37 "min_length": 4,38 "max_length": 32,39 "is_optional": False,40 "is_editable": False,41 "is_default": True,42 },43 'title': {44 "key": "title",45 "name": "title_name",46 "placeholder": "title_name",47 "type": 8,48 "is_optional": True,49 "is_editable": False,50 },51 'first_name': {52 "key": "first_name",53 "name": "first_name",54 "placeholder": "first_name",55 "type": 5,56 "max_length": 100,57 "is_optional": True,58 "is_editable": False,59 },60 'middle_name': {61 "key": "middle_name",62 "name": "middle_name",63 "placeholder": "middle_name",64 "type": 5,65 "max_length": 100,66 "is_optional": True,67 "is_editable": False,68 },69 'last_name': {70 "key": "last_name",71 "name": "last_name",72 "placeholder": "last_name",73 "type": 5,74 "max_length": 100,75 "is_optional": True,76 "is_editable": False,77 },78 'id_card': {79 "key": "id_card",80 "name": "id_card",81 "placeholder": "id_card",82 "type": 5,83 "max_length": 13,84 "is_optional": True,85 "is_editable": False,86 },87 'code2': {88 "key": "code2",89 "name": "licence_id",90 "placeholder": "licence_id",91 "type": 5,92 "max_length": 20,93 "is_optional": True,94 "is_editable": False,95 },96 'gender': {97 "key": "gender",98 "name": "gender",99 "placeholder": "gender",100 "type": 2,101 "is_optional": True,102 "is_editable": False,103 },104 'date_birth': {105 "key": "date_birth",106 "name": "date_of_birth",107 "placeholder": "date_of_birth",108 "type": 10,109 "is_optional": True,110 "is_editable": False,111 },112 'address': {113 "key": "address",114 "name": "address",115 "placeholder": "address",116 "type": 5,117 "max_length": 2000,118 "is_optional": True,119 "is_editable": False,120 },121 'phone': {122 "key": "phone",123 "name": "phone",124 "placeholder": "phone",125 "type": 5,126 "is_optional": True,127 "is_editable": False,128 },129 'company': {130 "key": "company",131 "name": "company_name",132 "placeholder": "company_name",133 "type": 5,134 "max_length": 200,135 "is_optional": True,136 "is_editable": False,137 },138 'count_experience': {139 "key": "count_experience",140 "name": "year_of_experience",141 "placeholder": "year_of_experience",142 "type": 13,143 "is_optional": True,144 "is_editable": False,145 },...
v_mware_ds_grouping_criteria.py
Source: v_mware_ds_grouping_criteria.py
1#2# Copyright 2021. Clumio, Inc.3#4from typing import Any, Dict, Mapping, Optional, Sequence, Type, TypeVar5T = TypeVar('T', bound='VMwareDsGroupingCriteria')6class VMwareDsGroupingCriteria:7 """Implementation of the 'VMwareDsGroupingCriteria' model.8 The entity type used to group organizational units for VMware resources.9 Attributes:10 is_editable:11 Determines whether or not this data group is editable. If false, then an12 organizational unit uses this data group.13 To edit this data group, all organizational units using it must be deleted.14 type:15 The entity type used to group organizational units for VMware resources.16 +--------------------------------+---------------------------------+17 | vmware_vcenter | VMware vCenter. |18 +================================+=================================+19 | vmware_vm_folder | VMware VM folder. |20 +--------------------------------+---------------------------------+21 | vmware_datacenter_folder | VMware datacenter folder. |22 +--------------------------------+---------------------------------+23 | vmware_compute_resource_folder | VMware compute resource folder. |24 +--------------------------------+---------------------------------+25 | vmware_datacenter | VMware datacenter. |26 +--------------------------------+---------------------------------+27 | vmware_compute_resource | VMware compute resource. |28 +--------------------------------+---------------------------------+29 | vmware_vm | VMware VM. |30 +--------------------------------+---------------------------------+31 | vmware_tag | VMware tag. |32 +--------------------------------+---------------------------------+33 """34 # Create a mapping from Model property names to API property names35 _names = {'is_editable': 'is_editable', 'type': 'type'}36 def __init__(self, is_editable: bool = None, type: str = None) -> None:37 """Constructor for the VMwareDsGroupingCriteria class."""38 # Initialize members of the class39 self.is_editable: bool = is_editable40 self.type: str = type41 @classmethod42 def from_dictionary(cls: Type, dictionary: Mapping[str, Any]) -> Optional[T]:43 """Creates an instance of this model from a dictionary44 Args:45 dictionary: A dictionary representation of the object as obtained46 from the deserialization of the server's response. The keys47 MUST match property names in the API description.48 Returns:49 object: An instance of this structure class.50 """51 if not dictionary:52 return None53 # Extract variables from the dictionary54 is_editable = dictionary.get('is_editable')55 type = dictionary.get('type')56 # Return an object of this model...
Playwright error connection refused in docker
playwright-python advanced setup
How to select an input according to a parent sibling label
Error when installing Microsoft Playwright
Trouble waiting for changes to complete that are triggered by Python Playwright `select_option`
Capturing and Storing Request Data Using Playwright for Python
Can Playwright be used to launch a browser instance
Trouble in Clicking on Log in Google Button of Pop Up Menu Playwright Python
Scrapy Playwright get date by clicking button
React locator example
I solved my problem. In fact my docker container (frontend) is called "app" which is also domain name of fronend application. My application is running locally on http. Chromium and geko drivers force httpS connection for some domain names one of which is "app". So i have to change name for my docker container wich contains frontend application.
Check out the latest blogs from LambdaTest on this topic:
The sky’s the limit (and even beyond that) when you want to run test automation. Technology has developed so much that you can reduce time and stay more productive than you used to 10 years ago. You needn’t put up with the limitations brought to you by Selenium if that’s your go-to automation testing tool. Instead, you can pick from various test automation frameworks and tools to write effective test cases and run them successfully.
When it comes to web automation testing, there are a number of frameworks like Selenium, Cypress, PlayWright, Puppeteer, etc., that make it to the ‘preferred list’ of frameworks. The choice of test automation framework depends on a range of parameters like type, complexity, scale, along with the framework expertise available within the team. However, it’s no surprise that Selenium is still the most preferred framework among developers and QAs.
Playwright is a framework that I’ve always heard great things about but never had a chance to pick up until earlier this year. And since then, it’s become one of my favorite test automation frameworks to use when building a new automation project. It’s easy to set up, feature-packed, and one of the fastest, most reliable frameworks I’ve worked with.
The speed at which tests are executed and the “dearth of smartness” in testing are the two major problems developers and testers encounter.
With the rapidly evolving technology due to its ever-increasing demand in today’s world, Digital Security has become a major concern for the Software Industry. There are various ways through which Digital Security can be achieved, Captcha being one of them.Captcha is easy for humans to solve but hard for “bots” and other malicious software to figure out. However, Captcha has always been tricky for the testers to automate, as many of them don’t know how to handle captcha in Selenium or using any other test automation framework.
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!