GUIDE ENG prefinal

dev-linux
Ivan Maslov 4 years ago
parent 658e1bfaa5
commit 87240285eb

@ -3,21 +3,6 @@ import psutil, datetime, logging, os, sys # stdout from logging
# Config settings
lPyOpenRPASourceFolderPathStr = r"..\Sources" # Path for test pyOpenRPA package
# INFO Relative/Absolute import see below - after settings init
# Template for import CP - Control Panels
# ATTENTION - Pay attention to CP names! Orchestrator is one for the all control panels per one machine
## !!! For Absolute import !!!
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# import pyRobot_CP
# pyRobot_CP.SettingsUpdate(inGSettings=gSettings)
## !!! For Relative import !!!
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# from pyRobot_CP import ControlPanel
# ControlPanel.SettingsUpdate(inGSettings=gSettings)
# Operations
if lPyOpenRPASourceFolderPathStr != "": sys.path.insert(0,os.path.abspath(os.path.join(lPyOpenRPASourceFolderPathStr))) # Path for test pyOpenRPA package
# Start import after config the pyOpenRPA folder
@ -26,28 +11,36 @@ from pyOpenRPA.Orchestrator import SettingsTemplate # Import functionallity
if __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.Orchestrator
from pyOpenRPA import Orchestrator # Import orchestrator main
gSettings = SettingsTemplate.Create(inModeStr="BASIC") # Create GSettings with basic configuration
gSettings = SettingsTemplate.Create(inModeStr="BASIC") # Create GSettings with basic configuration - no more config is available from the box - you can create own
# TEST Add User ND - Add Login ND to superuser of the Orchestrator
lUACClientDict = SettingsTemplate.__UACClientAdminCreate__()
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["LogViewerBool"]
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["CMDInputBool"]
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["ScreenshotViewerBool"]
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["RestartOrchestratorBool"]
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["RestartOrchestratorGITPullBool"]
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["RestartPCBool"]
# del lUACClientDict["pyOpenRPADict"]["RDPKeyDict"]
# del lUACClientDict["pyOpenRPADict"]["AgentKeyDict"]
# del lUACClientDict["pyOpenRPADict"]["CPKeyDict"]
#lUACClientDict["pyOpenRPADict"]["CPKeyDict"]["VersionCheck"]=True
#lUACClientDict["pyOpenRPADict"]["CPKeyDict"]["TEST"]=True
#lUACClientDict["pyOpenRPADict"]["AgentKeyDict"]["DESKTOP----;ND"]=True
Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="ND", inADStr="", inADIsDefaultBool=True, inURLList=[], inRoleHierarchyAllowedDict=lUACClientDict)
# TEST Add User IMaslov - Add Login IMaslov to superuser of the Orchestrator
Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="IMaslov", inADStr="", inADIsDefaultBool=True, inURLList=[])
# TEST Add Supertoken for the all access between robots
Orchestrator.UACSuperTokenUpdate(inGSettings=gSettings, inSuperTokenStr="1992-04-03-0643-ru-b4ff-openrpa52zzz")
# INFO Relative/Absolute import see below - after settings init
# Template for import CP - Control Panels
# ATTENTION - Pay attention to CP names! Orchestrator is one for the all control panels per one machine
## !!! For Absolute import control panels !!!
# try:
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# import pyRobot_CP
# pyRobot_CP.SettingsUpdate(inGSettings=gSettings)
# except Exception as e:
# gSettings["Logger"].exception(f"Exception when init CP. See below.")
## !!! For Relative import control panels !!!
# try:
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# from pyRobot_CP import ControlPanel
# ControlPanel.SettingsUpdate(inGSettings=gSettings)
# except Exception as e:
# gSettings["Logger"].exception(f"Exception when init CP. See below.")
## !!! For Relative import !!! CP Version Check
try:
sys.path.insert(0,os.path.abspath(os.path.join(r"")))

@ -35,7 +35,6 @@ Now you can use the following docs:
- ENG Guide MarkDown [|OPEN GITLAB|](Wiki/ENG_Guide/markdown/index.md)
- ENG Guide PDF [|WAIT|]()
- RUS Article: Less cost - no paid RPA [|OPEN HABR|](https://habr.com/ru/post/509644/)
- RUS Tutorial Desktop UI [|OPEN HABR|](https://habr.com/ru/post/509644/); [|OPEN GITLAB|](Wiki/RUS_Tutorial/DesktopGUI_Habr/index.md)
- RUS Tutorial Web UI [|OPEN HABR|](https://habr.com/ru/post/515310/); [|OPEN GITLAB|](Wiki/RUS_Tutorial/WebGUI_Habr/3.%20WebGUI_Habr.md)

@ -1,3 +1,5 @@
.. _3.-Copyrights-&-Contacts:
####################################
3. Copyrights & Contacts
####################################
@ -6,7 +8,16 @@ pyOpenRPA is created by Ivan Maslov (Russia).
Use it absolutely for free!
My purpose is to create #IT4Business models all over the world.
If you need IT help feel free to contact me (prefer e-mail or skype).
#IT4Business homepage - https://www.facebook.com/RU.IT4Business
#IT4Busines is the methodology which is created for build compact fast and reliable IT function in company.
If you has many IT specialists, very long deadlines for the IT tasks, many bugs in IT software - #IT4Business is for you :)
If you need some IT help - feel free to contact me (prefer e-mail or skype).
If you will find some issue in pyOpenRPA - write about it to me via e-mail/skype/gitlab issue.
Thank you!

@ -1,9 +0,0 @@
************************
4. How to start process
************************
Start configuration example
.. include:: ../../../Orchestrator/OrchestratorSettings.py
:literal:

@ -0,0 +1,19 @@
************************
4. How to use
************************
You need to run orchestrator process?
.. code-block:: python
if __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.Orchestrator
from pyOpenRPA import Orchestrator # Import orchestrator main
gSettings = SettingsTemplate.Create(inModeStr="BASIC") # Create GSettings with basic configuration - no more config is available from the box - you can create own
# Call the orchestrator main def
Orchestrator.Orchestrator(inGSettings=gSettings)
If you need more configurations - so you can see here:
.. include:: ../../../Orchestrator/OrchestratorSettings.py
:literal:

@ -0,0 +1,55 @@
####################################
5. UAC - User Access Control
####################################
*****************
About
*****************
Orchestrator has mega feature - user access control (UAC). This feature allow you to manipulate access of the web UI for the all users!
If you need to give admin rights - you don't customize UAC dict.
If you need to give some little rights for user only for one robot in orchestrator web panel - you can set the following properties in UAC dict.
To work with UAC you can use defs ``Orchestrator.UAC`` group.
***************************************************
UAC Dict for Orchestrator WEB UI rights
***************************************************
UAC Dict for pyOpenRPA Orchestrator WEB UI rights.
.. code-block:: python
"pyOpenRPADict":{
"CPKeyDict":{ # Empty dict - all access
# "CPKeyStr"{
# }
},
"RDPKeyDict":{ # Empty dict - all access
#"RDPKeyStr"{
# "FullscreenBool": True,
# "IgnoreBool":True,
# "ReconnectBool": True
# "NothingBool": True # USe option if you dont want to give some access to the RDP controls
# }
},
"AgentKeyDict": { # Empty dict - all access
# "AgentKeyStr"{
# }
},
"AdminDict":{ # Empty dict - all access
"LogViewerBool":True, # Show log viewer on the web page
"CMDInputBool":True, # Execute CMD on the server side and result to the logs
"ScreenshotViewerBool":True, # Show button to look screenshots
"RestartOrchestratorBool": True, # Restart orchestrator activity
"RestartOrchestratorGITPullBool": True, # Turn off (RDP remember) orc + git pull + Turn on (rdp remember)
"RestartPCBool": True, # Send CMD to restart pc
"NothingBool":True # USe option if you dont want to give some access to the RDP controls
},
"ActivityDict": { # Empty dict - all access
"ActivityListExecuteBool": True, # Execute activity at the current thread
"ActivityListAppendProcessorQueueBool": True # Append activity to the processor queue
}
}

@ -2,7 +2,7 @@
3. How to use
####################################
The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in OpenRPA.
The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in pyOpenRPA.
**************************************************
How to execute RPA script
@ -31,7 +31,7 @@ In order to use robot just add Robot tool folder in work directory and add line
Execute python script
############################################
The OpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
The pyOpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
- Execute in python x32 (\OpenRPA\Resources\WPy32-3720\python-3.7.2)
- Execute in python x64 (\OpenRPA\Resources\WPy64-3720\python-3.7.2.amd64)
- Execute from .cmd file

@ -10,7 +10,9 @@ Welcome to pyOpenRPA's wiki
.. image:: /img/ModalGuide.png
:alt: ModalGuide.png
*by Ivan Maslov (Russia)*
*by Ivan Maslov (Russia)* - see :ref:`3.-Copyrights-&-Contacts`.
! ATTENTION ! pyOpenRPA works only on MS Windows 7+/Server 2008+. Guys from Unix/Mac - sorry. We will come to you soon :)
**************************************************
Donate
@ -34,18 +36,34 @@ The pyOpenRPA is distributed under the MIT license which allows you to use it in
At the time of this writing the pyOpenRPA is successfully using in several big Russian companies. Companies in which it was decided to develop own RPA division with no dependencies on expensive licenses.
**************************************************
Structure
Repo structure
**************************************************
The pyOpenRPA has 3 main tools:
The description of the each folder in GitLab repo is going below:
- **Agent**: template build for the pyOpenRPA.Agent component
- **Orchestrator**: template build for the pyOpenRPA.Orchestrator component
- **Resources**: 3rd party resources which is needed to provide pyOpenRPA encapsulation from the Operating System (OS) dependencies.
- **Robot**: template build for the robot
- **Sources**: pyOpenRPA python package sources + sphinx sources
- **Studio**: build for the pyOpenRPA.Studio which support Desktop UI (support x32 and x64 desktop UI apps)
- **Utils**: many additional good tools for the python developer
- **Wiki**: compiled wiki documentation
**************************************************
The pyOpenRPA structure
**************************************************
The pyOpenRPA has 4 main tools:
############################################
- Studio
- Robot
- Orchestrator
- Agent
Studio
######################
Studio tool has been developed to help RPA-tors to create the robot algorythms.
The pyOpenRPA.Studio tool has been developed to help RPA-tors to create the robot algorythms.
**Features**
@ -57,7 +75,7 @@ Studio tool has been developed to help RPA-tors to create the robot algorythms.
Robot
######################
The Robot tool is the core of any action execution in the pyOpenRPA. All action from algorythms are perfoming by the Robot tool. It looks like a console process without graphic user interface.
The pyOpenRPA.Robot package is the core of any action execution in the pyOpenRPA. All action from algorythms are perfoming by the Robot tool. It looks like a console process without graphic user interface.
**Features**
@ -71,38 +89,42 @@ The Robot tool is the core of any action execution in the pyOpenRPA. All action
Orchestrator
######################
The Orchestrator tool has been developed to maintain robot infrastructure (2+ robots algorythm).
The pyOpenRPA.Orchestrator package has been developed to maintain robot infrastructure (2+ robots algorythm).
**Features**
- Start/Stop robot algorythm
- Start/Stop robot algorithm
- Robot scheduler
- Remote machine screenshot viewer
- Remote machine cmd shell
- Remote machine logs storage
**************************************************
Guide (in progress)
**************************************************
In wiki you can find:
in QUEUE
Agent
######################
The pyOpenRPA.Agent tool has been developed to maintain robot infrastructure (2+ robots algorythm).
- Theory & practice: Web app access (Chrome, Firefox, Opera)
- Theory & practice: Desktop app UI access (win32 and UI automation dlls)
- Theory & practice: Keyboard & mouse manipulation
- Theory & practice: Screen capture & image recognition
**Features**
- Send CMD to the RPA GUI session (start/safe stop/force stop/logout)
- Get screenshots from the RPA GUI session
- Get the list of the running processes
**************************************************
Tutorials
Wiki structure
**************************************************
- [ENG] Content in progress
- [RUS] Перейти в раздел туториалов
In wiki you can use the following docs:
- ENG Guide HTML [|OPEN GITLAB|](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/html/index.html)
- ENG Guide MarkDown [|OPEN GITLAB|](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/markdown/index.md)
- ENG Guide PDF [|WAIT|]()
- RUS Article: Less cost - no paid RPA [|OPEN HABR|](https://habr.com/ru/post/509644/)
- RUS Tutorial Desktop UI [|OPEN HABR|](https://habr.com/ru/post/509644/); [|OPEN GITLAB|](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/DesktopGUI_Habr/index.md)
- RUS Tutorial Web UI [|OPEN HABR|](https://habr.com/ru/post/515310/); [|OPEN GITLAB|](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/WebGUI_Habr/readme.md)
**************************************************
Content
Guide content
**************************************************
.. toctree::

@ -113,7 +113,8 @@
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -109,7 +109,8 @@
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -113,7 +113,8 @@
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>
@ -182,11 +183,15 @@
<div itemprop="articleBody">
<div class="section" id="copyrights-contacts">
<h1>3. Copyrights &amp; Contacts<a class="headerlink" href="#copyrights-contacts" title="Permalink to this headline"></a></h1>
<span id="id1"></span><h1>3. Copyrights &amp; Contacts<a class="headerlink" href="#copyrights-contacts" title="Permalink to this headline"></a></h1>
<p>pyOpenRPA is created by Ivan Maslov (Russia).
Use it absolutely for free!</p>
<p>My purpose is to create #IT4Business models all over the world.
If you need IT help feel free to contact me (prefer e-mail or skype).</p>
<p>My purpose is to create #IT4Business models all over the world.</p>
<p>#IT4Business homepage - <a class="reference external" href="https://www.facebook.com/RU.IT4Business">https://www.facebook.com/RU.IT4Business</a></p>
<p>#IT4Busines is the methodology which is created for build compact fast and reliable IT function in company.</p>
<p>If you has many IT specialists, very long deadlines for the IT tasks, many bugs in IT software - #IT4Business is for you :)</p>
<p>If you need some IT help - feel free to contact me (prefer e-mail or skype).</p>
<p>If you will find some issue in pyOpenRPA - write about it to me via e-mail/skype/gitlab issue.</p>
<p>Thank you!</p>
<div class="section" id="ivan-maslov-founder">
<h2>Ivan Maslov (founder)<a class="headerlink" href="#ivan-maslov-founder" title="Permalink to this headline"></a></h2>

@ -116,7 +116,8 @@
</li>
<li class="toctree-l1"><a class="reference internal" href="02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -125,7 +125,8 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -40,7 +40,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="4. How to start process" href="04_HowToStart.html" />
<link rel="next" title="4. How to use" href="04_HowToUse.html" />
<link rel="prev" title="2. Defs" href="02_Defs.html" />
</head>
@ -109,7 +109,8 @@
<li class="toctree-l1"><a class="reference internal" href="01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="02_Defs.html">2. Defs</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="05_UAC.html">5. UAC - User Access Control</a></li>
</ul>
@ -554,7 +555,7 @@
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="04_HowToStart.html" class="btn btn-neutral float-right" title="4. How to start process" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="04_HowToUse.html" class="btn btn-neutral float-right" title="4. How to use" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="02_Defs.html" class="btn btn-neutral float-left" title="2. Defs" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>4. How to start process &mdash; pyOpenRPA v1.2.0 documentation</title>
<title>4. How to use &mdash; pyOpenRPA v1.2.0 documentation</title>
@ -40,6 +40,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="5. UAC - User Access Control" href="05_UAC.html" />
<link rel="prev" title="3. gSettings Template" href="03_gSettingsTemplate.html" />
</head>
@ -108,7 +109,8 @@
<li class="toctree-l1"><a class="reference internal" href="01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">4. How to start process</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="05_UAC.html">5. UAC - User Access Control</a></li>
</ul>
@ -157,13 +159,13 @@
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>4. How to start process</li>
<li>4. How to use</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/Orchestrator/04_HowToStart.rst.txt" rel="nofollow"> View page source</a>
<a href="../_sources/Orchestrator/04_HowToUse.rst.txt" rel="nofollow"> View page source</a>
</li>
@ -176,29 +178,22 @@
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="how-to-start-process">
<h1>4. How to start process<a class="headerlink" href="#how-to-start-process" title="Permalink to this headline"></a></h1>
<p>Start configuration example</p>
<div class="section" id="how-to-use">
<h1>4. How to use<a class="headerlink" href="#how-to-use" title="Permalink to this headline"></a></h1>
<p>You need to run orchestrator process?</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span> <span class="c1"># New init way - allow run as module -m PyOpenRPA.Orchestrator</span>
<span class="kn">from</span> <span class="nn">pyOpenRPA</span> <span class="kn">import</span> <span class="n">Orchestrator</span> <span class="c1"># Import orchestrator main</span>
<span class="n">gSettings</span> <span class="o">=</span> <span class="n">SettingsTemplate</span><span class="o">.</span><span class="n">Create</span><span class="p">(</span><span class="n">inModeStr</span><span class="o">=</span><span class="s2">&quot;BASIC&quot;</span><span class="p">)</span> <span class="c1"># Create GSettings with basic configuration - no more config is available from the box - you can create own</span>
<span class="c1"># Call the orchestrator main def</span>
<span class="n">Orchestrator</span><span class="o">.</span><span class="n">Orchestrator</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">)</span>
</pre></div>
</div>
<p>If you need more configurations - so you can see here:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">psutil</span><span class="o">,</span> <span class="nn">datetime</span><span class="o">,</span> <span class="nn">logging</span><span class="o">,</span> <span class="nn">os</span><span class="o">,</span> <span class="nn">sys</span> <span class="c1"># stdout from logging</span>
<span class="c1"># Config settings</span>
<span class="n">lPyOpenRPASourceFolderPathStr</span> <span class="o">=</span> <span class="sa">r</span><span class="s2">&quot;..\Sources&quot;</span> <span class="c1"># Path for test pyOpenRPA package</span>
<span class="c1"># INFO Relative/Absolute import see below - after settings init</span>
<span class="c1"># Template for import CP - Control Panels</span>
<span class="c1"># ATTENTION - Pay attention to CP names! Orchestrator is one for the all control panels per one machine</span>
<span class="c1">## !!! For Absolute import !!!</span>
<span class="c1"># sys.path.insert(0,os.path.abspath(os.path.join(r&quot;..\ROBOT\Builds&quot;)))</span>
<span class="c1"># import pyRobot_CP</span>
<span class="c1"># pyRobot_CP.SettingsUpdate(inGSettings=gSettings)</span>
<span class="c1">## !!! For Relative import !!!</span>
<span class="c1"># sys.path.insert(0,os.path.abspath(os.path.join(r&quot;..\ROBOT\Builds&quot;)))</span>
<span class="c1"># from pyRobot_CP import ControlPanel</span>
<span class="c1"># ControlPanel.SettingsUpdate(inGSettings=gSettings)</span>
<span class="c1"># Operations</span>
<span class="k">if</span> <span class="n">lPyOpenRPASourceFolderPathStr</span> <span class="o">!=</span> <span class="s2">&quot;&quot;</span><span class="p">:</span> <span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">lPyOpenRPASourceFolderPathStr</span><span class="p">)))</span> <span class="c1"># Path for test pyOpenRPA package</span>
<span class="c1"># Start import after config the pyOpenRPA folder</span>
@ -207,28 +202,36 @@
<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span> <span class="c1"># New init way - allow run as module -m PyOpenRPA.Orchestrator</span>
<span class="kn">from</span> <span class="nn">pyOpenRPA</span> <span class="kn">import</span> <span class="n">Orchestrator</span> <span class="c1"># Import orchestrator main</span>
<span class="n">gSettings</span> <span class="o">=</span> <span class="n">SettingsTemplate</span><span class="o">.</span><span class="n">Create</span><span class="p">(</span><span class="n">inModeStr</span><span class="o">=</span><span class="s2">&quot;BASIC&quot;</span><span class="p">)</span> <span class="c1"># Create GSettings with basic configuration</span>
<span class="n">gSettings</span> <span class="o">=</span> <span class="n">SettingsTemplate</span><span class="o">.</span><span class="n">Create</span><span class="p">(</span><span class="n">inModeStr</span><span class="o">=</span><span class="s2">&quot;BASIC&quot;</span><span class="p">)</span> <span class="c1"># Create GSettings with basic configuration - no more config is available from the box - you can create own</span>
<span class="c1"># TEST Add User ND - Add Login ND to superuser of the Orchestrator</span>
<span class="n">lUACClientDict</span> <span class="o">=</span> <span class="n">SettingsTemplate</span><span class="o">.</span><span class="n">__UACClientAdminCreate__</span><span class="p">()</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;LogViewerBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;CMDInputBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;ScreenshotViewerBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;RestartOrchestratorBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;RestartOrchestratorGITPullBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;RestartPCBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;RDPKeyDict&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AgentKeyDict&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;CPKeyDict&quot;]</span>
<span class="c1">#lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;CPKeyDict&quot;][&quot;VersionCheck&quot;]=True</span>
<span class="c1">#lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;CPKeyDict&quot;][&quot;TEST&quot;]=True</span>
<span class="c1">#lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AgentKeyDict&quot;][&quot;DESKTOP----;ND&quot;]=True</span>
<span class="n">Orchestrator</span><span class="o">.</span><span class="n">UACUpdate</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">,</span> <span class="n">inADLoginStr</span><span class="o">=</span><span class="s2">&quot;ND&quot;</span><span class="p">,</span> <span class="n">inADStr</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">inADIsDefaultBool</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">inURLList</span><span class="o">=</span><span class="p">[],</span> <span class="n">inRoleHierarchyAllowedDict</span><span class="o">=</span><span class="n">lUACClientDict</span><span class="p">)</span>
<span class="c1"># TEST Add User IMaslov - Add Login IMaslov to superuser of the Orchestrator</span>
<span class="n">Orchestrator</span><span class="o">.</span><span class="n">UACUpdate</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">,</span> <span class="n">inADLoginStr</span><span class="o">=</span><span class="s2">&quot;IMaslov&quot;</span><span class="p">,</span> <span class="n">inADStr</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">inADIsDefaultBool</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">inURLList</span><span class="o">=</span><span class="p">[])</span>
<span class="c1"># TEST Add Supertoken for the all access between robots</span>
<span class="n">Orchestrator</span><span class="o">.</span><span class="n">UACSuperTokenUpdate</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">,</span> <span class="n">inSuperTokenStr</span><span class="o">=</span><span class="s2">&quot;1992-04-03-0643-ru-b4ff-openrpa52zzz&quot;</span><span class="p">)</span>
<span class="c1"># INFO Relative/Absolute import see below - after settings init</span>
<span class="c1"># Template for import CP - Control Panels</span>
<span class="c1"># ATTENTION - Pay attention to CP names! Orchestrator is one for the all control panels per one machine</span>
<span class="c1">## !!! For Absolute import control panels !!!</span>
<span class="c1"># try:</span>
<span class="c1"># sys.path.insert(0,os.path.abspath(os.path.join(r&quot;..\ROBOT\Builds&quot;)))</span>
<span class="c1"># import pyRobot_CP</span>
<span class="c1"># pyRobot_CP.SettingsUpdate(inGSettings=gSettings)</span>
<span class="c1"># except Exception as e:</span>
<span class="c1"># gSettings[&quot;Logger&quot;].exception(f&quot;Exception when init CP. See below.&quot;)</span>
<span class="c1">## !!! For Relative import control panels !!!</span>
<span class="c1"># try:</span>
<span class="c1"># sys.path.insert(0,os.path.abspath(os.path.join(r&quot;..\ROBOT\Builds&quot;)))</span>
<span class="c1"># from pyRobot_CP import ControlPanel</span>
<span class="c1"># ControlPanel.SettingsUpdate(inGSettings=gSettings)</span>
<span class="c1"># except Exception as e:</span>
<span class="c1"># gSettings[&quot;Logger&quot;].exception(f&quot;Exception when init CP. See below.&quot;)</span>
<span class="c1">## !!! For Relative import !!! CP Version Check</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;&quot;</span><span class="p">)))</span>
@ -259,6 +262,7 @@
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="05_UAC.html" class="btn btn-neutral float-right" title="5. UAC - User Access Control" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="03_gSettingsTemplate.html" class="btn btn-neutral float-left" title="3. gSettings Template" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>

@ -0,0 +1,279 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>5. UAC - User Access Control &mdash; pyOpenRPA v1.2.0 documentation</title>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="prev" title="4. How to use" href="04_HowToUse.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> pyOpenRPA
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">GENERAL</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../01_HowToInstall.html">1. How to install</a></li>
<li class="toctree-l1"><a class="reference internal" href="../02_RoadMap.html">2. Roadmap</a></li>
<li class="toctree-l1"><a class="reference internal" href="../03_Copyrights_Contacts.html">3. Copyrights &amp; Contacts</a></li>
</ul>
<p class="caption"><span class="caption-text">ROBOT</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../Robot/01_Robot.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Robot/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Robot/03_HowToUse.html">3. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Robot/04_Dependencies.html">4. Dependencies</a></li>
</ul>
<p class="caption"><span class="caption-text">STUDIO</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../Studio/01_Studio.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Studio/02_HowToUse.html">2. How to use</a></li>
</ul>
<p class="caption"><span class="caption-text">ORCHESTRATOR</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">5. UAC - User Access Control</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#about">About</a></li>
<li class="toctree-l2"><a class="reference internal" href="#uac-dict-for-orchestrator-web-ui-rights">UAC Dict for Orchestrator WEB UI rights</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">pyOpenRPA</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>5. UAC - User Access Control</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/Orchestrator/05_UAC.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="uac-user-access-control">
<h1>5. UAC - User Access Control<a class="headerlink" href="#uac-user-access-control" title="Permalink to this headline"></a></h1>
<div class="section" id="about">
<h2>About<a class="headerlink" href="#about" title="Permalink to this headline"></a></h2>
<p>Orchestrator has mega feature - user access control (UAC). This feature allow you to manipulate access of the web UI for the all users!</p>
<p>If you need to give admin rights - you dont customize UAC dict.</p>
<p>If you need to give some little rights for user only for one robot in orchestrator web panel - you can set the following properties in UAC dict.</p>
<p>To work with UAC you can use defs <code class="docutils literal notranslate"><span class="pre">Orchestrator.UAC</span></code> group.</p>
</div>
<div class="section" id="uac-dict-for-orchestrator-web-ui-rights">
<h2>UAC Dict for Orchestrator WEB UI rights<a class="headerlink" href="#uac-dict-for-orchestrator-web-ui-rights" title="Permalink to this headline"></a></h2>
<p>UAC Dict for pyOpenRPA Orchestrator WEB UI rights.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="s2">&quot;pyOpenRPADict&quot;</span><span class="p">:{</span>
<span class="s2">&quot;CPKeyDict&quot;</span><span class="p">:{</span> <span class="c1"># Empty dict - all access</span>
<span class="c1"># &quot;CPKeyStr&quot;{</span>
<span class="c1"># }</span>
<span class="p">},</span>
<span class="s2">&quot;RDPKeyDict&quot;</span><span class="p">:{</span> <span class="c1"># Empty dict - all access</span>
<span class="c1">#&quot;RDPKeyStr&quot;{</span>
<span class="c1"># &quot;FullscreenBool&quot;: True,</span>
<span class="c1"># &quot;IgnoreBool&quot;:True,</span>
<span class="c1"># &quot;ReconnectBool&quot;: True</span>
<span class="c1"># &quot;NothingBool&quot;: True # USe option if you dont want to give some access to the RDP controls</span>
<span class="c1"># }</span>
<span class="p">},</span>
<span class="s2">&quot;AgentKeyDict&quot;</span><span class="p">:</span> <span class="p">{</span> <span class="c1"># Empty dict - all access</span>
<span class="c1"># &quot;AgentKeyStr&quot;{</span>
<span class="c1"># }</span>
<span class="p">},</span>
<span class="s2">&quot;AdminDict&quot;</span><span class="p">:{</span> <span class="c1"># Empty dict - all access</span>
<span class="s2">&quot;LogViewerBool&quot;</span><span class="p">:</span><span class="kc">True</span><span class="p">,</span> <span class="c1"># Show log viewer on the web page</span>
<span class="s2">&quot;CMDInputBool&quot;</span><span class="p">:</span><span class="kc">True</span><span class="p">,</span> <span class="c1"># Execute CMD on the server side and result to the logs</span>
<span class="s2">&quot;ScreenshotViewerBool&quot;</span><span class="p">:</span><span class="kc">True</span><span class="p">,</span> <span class="c1"># Show button to look screenshots</span>
<span class="s2">&quot;RestartOrchestratorBool&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="c1"># Restart orchestrator activity</span>
<span class="s2">&quot;RestartOrchestratorGITPullBool&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="c1"># Turn off (RDP remember) orc + git pull + Turn on (rdp remember)</span>
<span class="s2">&quot;RestartPCBool&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="c1"># Send CMD to restart pc</span>
<span class="s2">&quot;NothingBool&quot;</span><span class="p">:</span><span class="kc">True</span> <span class="c1"># USe option if you dont want to give some access to the RDP controls</span>
<span class="p">},</span>
<span class="s2">&quot;ActivityDict&quot;</span><span class="p">:</span> <span class="p">{</span> <span class="c1"># Empty dict - all access</span>
<span class="s2">&quot;ActivityListExecuteBool&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="c1"># Execute activity at the current thread</span>
<span class="s2">&quot;ActivityListAppendProcessorQueueBool&quot;</span><span class="p">:</span> <span class="kc">True</span> <span class="c1"># Append activity to the processor queue</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="04_HowToUse.html" class="btn btn-neutral float-left" title="4. How to use" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&#169; Copyright 2021, Ivan Maslov.
</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

@ -112,7 +112,8 @@
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -119,7 +119,8 @@
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -137,7 +137,8 @@
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>
@ -207,7 +208,7 @@
<div class="section" id="how-to-use">
<h1>3. How to use<a class="headerlink" href="#how-to-use" title="Permalink to this headline"></a></h1>
<p>The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in OpenRPA.</p>
<p>The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in pyOpenRPA.</p>
<div class="section" id="how-to-execute-rpa-script">
<h2>How to execute RPA script<a class="headerlink" href="#how-to-execute-rpa-script" title="Permalink to this headline"></a></h2>
<p>You can use the robot by the several ways:</p>
@ -230,7 +231,7 @@
</div>
<div class="section" id="execute-python-script">
<h3>Execute python script<a class="headerlink" href="#execute-python-script" title="Permalink to this headline"></a></h3>
<p>The OpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
<p>The pyOpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
- Execute in python x32 (OpenRPAResourcesWPy32-3720python-3.7.2)
- Execute in python x64 (OpenRPAResourcesWPy64-3720python-3.7.2.amd64)
- Execute from .cmd file</p>

@ -109,7 +109,8 @@
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -109,7 +109,8 @@
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -132,7 +132,8 @@
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -107,7 +107,8 @@
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -107,7 +107,8 @@
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>
@ -1883,8 +1884,7 @@
<span class="k">if</span> <span class="n">lL</span><span class="p">:</span> <span class="n">lL</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Orchestrator start activity run&quot;</span><span class="p">)</span> <span class="c1">#Logging</span>
<span class="k">for</span> <span class="n">lActivityItem</span> <span class="ow">in</span> <span class="n">gSettingsDict</span><span class="p">[</span><span class="s2">&quot;OrchestratorStart&quot;</span><span class="p">][</span><span class="s2">&quot;ActivityList&quot;</span><span class="p">]:</span>
<span class="c1"># Processor.ActivityListOrDict(lActivityItem)</span>
<span class="n">Processor</span><span class="o">.</span><span class="n">ActivityListExecute</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettingsDict</span><span class="p">,</span><span class="n">inActivityList</span><span class="o">=</span><span class="n">BackwardCompatibility</span><span class="o">.</span><span class="n">v1_2_0_ProcessorOld2NewActivityDict</span><span class="p">(</span><span class="n">lActivityItem</span><span class="p">))</span>
<span class="n">Processor</span><span class="o">.</span><span class="n">ActivityListExecute</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettingsDict</span><span class="p">,</span><span class="n">inActivityList</span><span class="o">=</span><span class="p">[</span><span class="n">BackwardCompatibility</span><span class="o">.</span><span class="n">v1_2_0_ProcessorOld2NewActivityDict</span><span class="p">(</span><span class="n">lActivityItem</span><span class="p">)])</span>
<span class="c1"># Processor thread</span>
<span class="n">lProcessorThread</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Thread</span><span class="p">(</span><span class="n">target</span><span class="o">=</span> <span class="n">Processor</span><span class="o">.</span><span class="n">ProcessorRunSync</span><span class="p">,</span> <span class="n">kwargs</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;inGSettings&quot;</span><span class="p">:</span><span class="n">gSettingsDict</span><span class="p">,</span> <span class="s2">&quot;inRobotRDPThreadControlDict&quot;</span><span class="p">:</span><span class="n">lRobotRDPThreadControlDict</span><span class="p">})</span>
<span class="n">lProcessorThread</span><span class="o">.</span><span class="n">daemon</span> <span class="o">=</span> <span class="kc">True</span> <span class="c1"># Run the thread in daemon mode.</span>

@ -107,7 +107,8 @@
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -1,3 +1,5 @@
.. _3.-Copyrights-&-Contacts:
####################################
3. Copyrights & Contacts
####################################
@ -6,7 +8,16 @@ pyOpenRPA is created by Ivan Maslov (Russia).
Use it absolutely for free!
My purpose is to create #IT4Business models all over the world.
If you need IT help feel free to contact me (prefer e-mail or skype).
#IT4Business homepage - https://www.facebook.com/RU.IT4Business
#IT4Busines is the methodology which is created for build compact fast and reliable IT function in company.
If you has many IT specialists, very long deadlines for the IT tasks, many bugs in IT software - #IT4Business is for you :)
If you need some IT help - feel free to contact me (prefer e-mail or skype).
If you will find some issue in pyOpenRPA - write about it to me via e-mail/skype/gitlab issue.
Thank you!

@ -1,9 +0,0 @@
************************
4. How to start process
************************
Start configuration example
.. include:: ../../../Orchestrator/OrchestratorSettings.py
:literal:

@ -0,0 +1,19 @@
************************
4. How to use
************************
You need to run orchestrator process?
.. code-block:: python
if __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.Orchestrator
from pyOpenRPA import Orchestrator # Import orchestrator main
gSettings = SettingsTemplate.Create(inModeStr="BASIC") # Create GSettings with basic configuration - no more config is available from the box - you can create own
# Call the orchestrator main def
Orchestrator.Orchestrator(inGSettings=gSettings)
If you need more configurations - so you can see here:
.. include:: ../../../Orchestrator/OrchestratorSettings.py
:literal:

@ -0,0 +1,55 @@
####################################
5. UAC - User Access Control
####################################
*****************
About
*****************
Orchestrator has mega feature - user access control (UAC). This feature allow you to manipulate access of the web UI for the all users!
If you need to give admin rights - you don't customize UAC dict.
If you need to give some little rights for user only for one robot in orchestrator web panel - you can set the following properties in UAC dict.
To work with UAC you can use defs ``Orchestrator.UAC`` group.
***************************************************
UAC Dict for Orchestrator WEB UI rights
***************************************************
UAC Dict for pyOpenRPA Orchestrator WEB UI rights.
.. code-block:: python
"pyOpenRPADict":{
"CPKeyDict":{ # Empty dict - all access
# "CPKeyStr"{
# }
},
"RDPKeyDict":{ # Empty dict - all access
#"RDPKeyStr"{
# "FullscreenBool": True,
# "IgnoreBool":True,
# "ReconnectBool": True
# "NothingBool": True # USe option if you dont want to give some access to the RDP controls
# }
},
"AgentKeyDict": { # Empty dict - all access
# "AgentKeyStr"{
# }
},
"AdminDict":{ # Empty dict - all access
"LogViewerBool":True, # Show log viewer on the web page
"CMDInputBool":True, # Execute CMD on the server side and result to the logs
"ScreenshotViewerBool":True, # Show button to look screenshots
"RestartOrchestratorBool": True, # Restart orchestrator activity
"RestartOrchestratorGITPullBool": True, # Turn off (RDP remember) orc + git pull + Turn on (rdp remember)
"RestartPCBool": True, # Send CMD to restart pc
"NothingBool":True # USe option if you dont want to give some access to the RDP controls
},
"ActivityDict": { # Empty dict - all access
"ActivityListExecuteBool": True, # Execute activity at the current thread
"ActivityListAppendProcessorQueueBool": True # Append activity to the processor queue
}
}

@ -2,7 +2,7 @@
3. How to use
####################################
The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in OpenRPA.
The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in pyOpenRPA.
**************************************************
How to execute RPA script
@ -31,7 +31,7 @@ In order to use robot just add Robot tool folder in work directory and add line
Execute python script
############################################
The OpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
The pyOpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
- Execute in python x32 (\OpenRPA\Resources\WPy32-3720\python-3.7.2)
- Execute in python x64 (\OpenRPA\Resources\WPy64-3720\python-3.7.2.amd64)
- Execute from .cmd file

@ -10,7 +10,9 @@ Welcome to pyOpenRPA's wiki
.. image:: /img/ModalGuide.png
:alt: ModalGuide.png
*by Ivan Maslov (Russia)*
*by Ivan Maslov (Russia)* - see :ref:`3.-Copyrights-&-Contacts`.
! ATTENTION ! pyOpenRPA works only on MS Windows 7+/Server 2008+. Guys from Unix/Mac - sorry. We will come to you soon :)
**************************************************
Donate
@ -34,18 +36,34 @@ The pyOpenRPA is distributed under the MIT license which allows you to use it in
At the time of this writing the pyOpenRPA is successfully using in several big Russian companies. Companies in which it was decided to develop own RPA division with no dependencies on expensive licenses.
**************************************************
Structure
Repo structure
**************************************************
The pyOpenRPA has 3 main tools:
The description of the each folder in GitLab repo is going below:
- **Agent**: template build for the pyOpenRPA.Agent component
- **Orchestrator**: template build for the pyOpenRPA.Orchestrator component
- **Resources**: 3rd party resources which is needed to provide pyOpenRPA encapsulation from the Operating System (OS) dependencies.
- **Robot**: template build for the robot
- **Sources**: pyOpenRPA python package sources + sphinx sources
- **Studio**: build for the pyOpenRPA.Studio which support Desktop UI (support x32 and x64 desktop UI apps)
- **Utils**: many additional good tools for the python developer
- **Wiki**: compiled wiki documentation
**************************************************
The pyOpenRPA structure
**************************************************
The pyOpenRPA has 4 main tools:
############################################
- Studio
- Robot
- Orchestrator
- Agent
Studio
######################
Studio tool has been developed to help RPA-tors to create the robot algorythms.
The pyOpenRPA.Studio tool has been developed to help RPA-tors to create the robot algorythms.
**Features**
@ -57,7 +75,7 @@ Studio tool has been developed to help RPA-tors to create the robot algorythms.
Robot
######################
The Robot tool is the core of any action execution in the pyOpenRPA. All action from algorythms are perfoming by the Robot tool. It looks like a console process without graphic user interface.
The pyOpenRPA.Robot package is the core of any action execution in the pyOpenRPA. All action from algorythms are perfoming by the Robot tool. It looks like a console process without graphic user interface.
**Features**
@ -71,38 +89,42 @@ The Robot tool is the core of any action execution in the pyOpenRPA. All action
Orchestrator
######################
The Orchestrator tool has been developed to maintain robot infrastructure (2+ robots algorythm).
The pyOpenRPA.Orchestrator package has been developed to maintain robot infrastructure (2+ robots algorythm).
**Features**
- Start/Stop robot algorythm
- Start/Stop robot algorithm
- Robot scheduler
- Remote machine screenshot viewer
- Remote machine cmd shell
- Remote machine logs storage
**************************************************
Guide (in progress)
**************************************************
In wiki you can find:
in QUEUE
Agent
######################
The pyOpenRPA.Agent tool has been developed to maintain robot infrastructure (2+ robots algorythm).
- Theory & practice: Web app access (Chrome, Firefox, Opera)
- Theory & practice: Desktop app UI access (win32 and UI automation dlls)
- Theory & practice: Keyboard & mouse manipulation
- Theory & practice: Screen capture & image recognition
**Features**
- Send CMD to the RPA GUI session (start/safe stop/force stop/logout)
- Get screenshots from the RPA GUI session
- Get the list of the running processes
**************************************************
Tutorials
Wiki structure
**************************************************
- [ENG] Content in progress
- [RUS] Перейти в раздел туториалов
In wiki you can use the following docs:
- ENG Guide HTML [|OPEN GITLAB|](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/html/index.html)
- ENG Guide MarkDown [|OPEN GITLAB|](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/markdown/index.md)
- ENG Guide PDF [|WAIT|]()
- RUS Article: Less cost - no paid RPA [|OPEN HABR|](https://habr.com/ru/post/509644/)
- RUS Tutorial Desktop UI [|OPEN HABR|](https://habr.com/ru/post/509644/); [|OPEN GITLAB|](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/DesktopGUI_Habr/index.md)
- RUS Tutorial Web UI [|OPEN HABR|](https://habr.com/ru/post/515310/); [|OPEN GITLAB|](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/WebGUI_Habr/readme.md)
**************************************************
Content
Guide content
**************************************************
.. toctree::

@ -107,7 +107,8 @@
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -108,7 +108,8 @@
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>
@ -179,7 +180,8 @@
<div class="section" id="welcome-to-pyopenrpa-s-wiki">
<h1>Welcome to pyOpenRPAs wiki<a class="headerlink" href="#welcome-to-pyopenrpa-s-wiki" title="Permalink to this headline"></a></h1>
<img alt="ModalGuide.png" src="_images/ModalGuide.png" />
<p><em>by Ivan Maslov (Russia)</em></p>
<p><em>by Ivan Maslov (Russia)</em> - see <a class="reference internal" href="03_Copyrights_Contacts.html#copyrights-contacts"><span class="std std-ref">3. Copyrights &amp; Contacts</span></a>.</p>
<p>! ATTENTION ! pyOpenRPA works only on MS Windows 7+/Server 2008+. Guys from Unix/Mac - sorry. We will come to you soon :)</p>
<div class="section" id="donate">
<h2>Donate<a class="headerlink" href="#donate" title="Permalink to this headline"></a></h2>
<p>pyOpenRPA is absolutely non-commercial project.</p>
@ -195,19 +197,34 @@ Powerful OpenSource RPA tool for business (based on python 3). Best performance
The pyOpenRPA is distributed under the MIT license which allows you to use it in any way you want and any time you need without any restrictions.
At the time of this writing the pyOpenRPA is successfully using in several big Russian companies. Companies in which it was decided to develop own RPA division with no dependencies on expensive licenses.</p>
</div>
<div class="section" id="structure">
<h2>Structure<a class="headerlink" href="#structure" title="Permalink to this headline"></a></h2>
<div class="section" id="the-pyopenrpa-has-3-main-tools">
<h3>The pyOpenRPA has 3 main tools:<a class="headerlink" href="#the-pyopenrpa-has-3-main-tools" title="Permalink to this headline"></a></h3>
<div class="section" id="repo-structure">
<h2>Repo structure<a class="headerlink" href="#repo-structure" title="Permalink to this headline"></a></h2>
<p>The description of the each folder in GitLab repo is going below:</p>
<ul class="simple">
<li><p><strong>Agent</strong>: template build for the pyOpenRPA.Agent component</p></li>
<li><p><strong>Orchestrator</strong>: template build for the pyOpenRPA.Orchestrator component</p></li>
<li><p><strong>Resources</strong>: 3rd party resources which is needed to provide pyOpenRPA encapsulation from the Operating System (OS) dependencies.</p></li>
<li><p><strong>Robot</strong>: template build for the robot</p></li>
<li><p><strong>Sources</strong>: pyOpenRPA python package sources + sphinx sources</p></li>
<li><p><strong>Studio</strong>: build for the pyOpenRPA.Studio which support Desktop UI (support x32 and x64 desktop UI apps)</p></li>
<li><p><strong>Utils</strong>: many additional good tools for the python developer</p></li>
<li><p><strong>Wiki</strong>: compiled wiki documentation</p></li>
</ul>
</div>
<div class="section" id="the-pyopenrpa-structure">
<h2>The pyOpenRPA structure<a class="headerlink" href="#the-pyopenrpa-structure" title="Permalink to this headline"></a></h2>
<div class="section" id="the-pyopenrpa-has-4-main-tools">
<h3>The pyOpenRPA has 4 main tools:<a class="headerlink" href="#the-pyopenrpa-has-4-main-tools" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Studio</p></li>
<li><p>Robot</p></li>
<li><p>Orchestrator</p></li>
<li><p>Agent</p></li>
</ul>
</div>
<div class="section" id="studio">
<h3>Studio<a class="headerlink" href="#studio" title="Permalink to this headline"></a></h3>
<p>Studio tool has been developed to help RPA-tors to create the robot algorythms.</p>
<p>The pyOpenRPA.Studio tool has been developed to help RPA-tors to create the robot algorythms.</p>
<p><strong>Features</strong></p>
<ul class="simple">
<li><p>Run actions</p></li>
@ -219,7 +236,7 @@ At the time of this writing the pyOpenRPA is successfully using in several big R
</div>
<div class="section" id="robot">
<h3>Robot<a class="headerlink" href="#robot" title="Permalink to this headline"></a></h3>
<p>The Robot tool is the core of any action execution in the pyOpenRPA. All action from algorythms are perfoming by the Robot tool. It looks like a console process without graphic user interface.</p>
<p>The pyOpenRPA.Robot package is the core of any action execution in the pyOpenRPA. All action from algorythms are perfoming by the Robot tool. It looks like a console process without graphic user interface.</p>
<p><strong>Features</strong></p>
<ul class="simple">
<li><p>Based on Python (killer feature)</p></li>
@ -232,37 +249,41 @@ At the time of this writing the pyOpenRPA is successfully using in several big R
</div>
<div class="section" id="orchestrator">
<h3>Orchestrator<a class="headerlink" href="#orchestrator" title="Permalink to this headline"></a></h3>
<p>The Orchestrator tool has been developed to maintain robot infrastructure (2+ robots algorythm).</p>
<p>The pyOpenRPA.Orchestrator package has been developed to maintain robot infrastructure (2+ robots algorythm).</p>
<p><strong>Features</strong></p>
<ul class="simple">
<li><p>Start/Stop robot algorythm</p></li>
<li><p>Start/Stop robot algorithm</p></li>
<li><p>Robot scheduler</p></li>
<li><p>Remote machine screenshot viewer</p></li>
<li><p>Remote machine cmd shell</p></li>
<li><p>Remote machine logs storage</p></li>
</ul>
</div>
</div>
<div class="section" id="guide-in-progress">
<h2>Guide (in progress)<a class="headerlink" href="#guide-in-progress" title="Permalink to this headline"></a></h2>
<p>In wiki you can find:
in QUEUE</p>
<div class="section" id="agent">
<h3>Agent<a class="headerlink" href="#agent" title="Permalink to this headline"></a></h3>
<p>The pyOpenRPA.Agent tool has been developed to maintain robot infrastructure (2+ robots algorythm).</p>
<p><strong>Features</strong></p>
<ul class="simple">
<li><p>Theory &amp; practice: Web app access (Chrome, Firefox, Opera)</p></li>
<li><p>Theory &amp; practice: Desktop app UI access (win32 and UI automation dlls)</p></li>
<li><p>Theory &amp; practice: Keyboard &amp; mouse manipulation</p></li>
<li><p>Theory &amp; practice: Screen capture &amp; image recognition</p></li>
<li><p>Send CMD to the RPA GUI session (start/safe stop/force stop/logout)</p></li>
<li><p>Get screenshots from the RPA GUI session</p></li>
<li><p>Get the list of the running processes</p></li>
</ul>
</div>
<div class="section" id="tutorials">
<h2>Tutorials<a class="headerlink" href="#tutorials" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="wiki-structure">
<h2>Wiki structure<a class="headerlink" href="#wiki-structure" title="Permalink to this headline"></a></h2>
<p>In wiki you can use the following docs:</p>
<ul class="simple">
<li><p>[ENG] Content in progress</p></li>
<li><p>[RUS] Перейти в раздел туториалов</p></li>
<li><p>ENG Guide HTML [<a href="#id1"><span class="problematic" id="id2">|OPEN GITLAB|</span></a>](<a class="reference external" href="https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/html/index.html">https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/html/index.html</a>)</p></li>
<li><p>ENG Guide MarkDown [<a href="#id3"><span class="problematic" id="id4">|OPEN GITLAB|</span></a>](<a class="reference external" href="https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/markdown/index.md">https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/markdown/index.md</a>)</p></li>
<li><p>ENG Guide PDF [<a href="#id5"><span class="problematic" id="id6">|WAIT|</span></a>]()</p></li>
<li><p>RUS Article: Less cost - no paid RPA [<a href="#id7"><span class="problematic" id="id8">|OPEN HABR|</span></a>](<a class="reference external" href="https://habr.com/ru/post/509644/">https://habr.com/ru/post/509644/</a>)</p></li>
<li><p>RUS Tutorial Desktop UI [<a href="#id9"><span class="problematic" id="id10">|OPEN HABR|</span></a>](<a class="reference external" href="https://habr.com/ru/post/509644/">https://habr.com/ru/post/509644/</a>); [<a href="#id11"><span class="problematic" id="id12">|OPEN GITLAB|</span></a>](<a class="reference external" href="https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/DesktopGUI_Habr/index.md">https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/DesktopGUI_Habr/index.md</a>)</p></li>
<li><p>RUS Tutorial Web UI [<a href="#id13"><span class="problematic" id="id14">|OPEN HABR|</span></a>](<a class="reference external" href="https://habr.com/ru/post/515310/">https://habr.com/ru/post/515310/</a>); [<a href="#id15"><span class="problematic" id="id16">|OPEN GITLAB|</span></a>](<a class="reference external" href="https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/WebGUI_Habr/readme.md">https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/WebGUI_Habr/readme.md</a>)</p></li>
</ul>
</div>
<div class="section" id="content">
<h2>Content<a class="headerlink" href="#content" title="Permalink to this headline"></a></h2>
<div class="section" id="guide-content">
<h2>Guide content<a class="headerlink" href="#guide-content" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<p class="caption"><span class="caption-text">GENERAL</span></p>
<ul>
@ -345,7 +366,12 @@ in QUEUE</p>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/05_UAC.html">5. UAC - User Access Control</a><ul>
<li class="toctree-l2"><a class="reference internal" href="Orchestrator/05_UAC.html#about">About</a></li>
<li class="toctree-l2"><a class="reference internal" href="Orchestrator/05_UAC.html#uac-dict-for-orchestrator-web-ui-rights">UAC Dict for Orchestrator WEB UI rights</a></li>
</ul>
</li>
</ul>
</div>
</div>

Binary file not shown.

@ -110,7 +110,8 @@
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

@ -110,7 +110,8 @@
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/01_Orchestrator.html">1. Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/02_Defs.html">2. Defs</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToStart.html">4. How to start process</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/04_HowToUse.html">4. How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
</ul>

File diff suppressed because one or more lines are too long

@ -4,7 +4,16 @@ pyOpenRPA is created by Ivan Maslov (Russia).
Use it absolutely for free!
My purpose is to create #IT4Business models all over the world.
If you need IT help feel free to contact me (prefer e-mail or skype).
#IT4Business homepage - [https://www.facebook.com/RU.IT4Business](https://www.facebook.com/RU.IT4Business)
#IT4Busines is the methodology which is created for build compact fast and reliable IT function in company.
If you has many IT specialists, very long deadlines for the IT tasks, many bugs in IT software - #IT4Business is for you :)
If you need some IT help - feel free to contact me (prefer e-mail or skype).
If you will find some issue in pyOpenRPA - write about it to me via e-mail/skype/gitlab issue.
Thank you!

@ -1,6 +1,16 @@
# 4. How to start process
# 4. How to use
Start configuration example
You need to run orchestrator process?
```
if __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.Orchestrator
from pyOpenRPA import Orchestrator # Import orchestrator main
gSettings = SettingsTemplate.Create(inModeStr="BASIC") # Create GSettings with basic configuration - no more config is available from the box - you can create own
# Call the orchestrator main def
Orchestrator.Orchestrator(inGSettings=gSettings)
```
If you need more configurations - so you can see here:
```
import psutil, datetime, logging, os, sys # stdout from logging
@ -8,21 +18,6 @@ import psutil, datetime, logging, os, sys # stdout from logging
# Config settings
lPyOpenRPASourceFolderPathStr = r"..\Sources" # Path for test pyOpenRPA package
# INFO Relative/Absolute import see below - after settings init
# Template for import CP - Control Panels
# ATTENTION - Pay attention to CP names! Orchestrator is one for the all control panels per one machine
## !!! For Absolute import !!!
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# import pyRobot_CP
# pyRobot_CP.SettingsUpdate(inGSettings=gSettings)
## !!! For Relative import !!!
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# from pyRobot_CP import ControlPanel
# ControlPanel.SettingsUpdate(inGSettings=gSettings)
# Operations
if lPyOpenRPASourceFolderPathStr != "": sys.path.insert(0,os.path.abspath(os.path.join(lPyOpenRPASourceFolderPathStr))) # Path for test pyOpenRPA package
# Start import after config the pyOpenRPA folder
@ -31,28 +26,36 @@ from pyOpenRPA.Orchestrator import SettingsTemplate # Import functionallity
if __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.Orchestrator
from pyOpenRPA import Orchestrator # Import orchestrator main
gSettings = SettingsTemplate.Create(inModeStr="BASIC") # Create GSettings with basic configuration
gSettings = SettingsTemplate.Create(inModeStr="BASIC") # Create GSettings with basic configuration - no more config is available from the box - you can create own
# TEST Add User ND - Add Login ND to superuser of the Orchestrator
lUACClientDict = SettingsTemplate.__UACClientAdminCreate__()
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["LogViewerBool"]
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["CMDInputBool"]
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["ScreenshotViewerBool"]
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["RestartOrchestratorBool"]
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["RestartOrchestratorGITPullBool"]
# del lUACClientDict["pyOpenRPADict"]["AdminDict"]["RestartPCBool"]
# del lUACClientDict["pyOpenRPADict"]["RDPKeyDict"]
# del lUACClientDict["pyOpenRPADict"]["AgentKeyDict"]
# del lUACClientDict["pyOpenRPADict"]["CPKeyDict"]
#lUACClientDict["pyOpenRPADict"]["CPKeyDict"]["VersionCheck"]=True
#lUACClientDict["pyOpenRPADict"]["CPKeyDict"]["TEST"]=True
#lUACClientDict["pyOpenRPADict"]["AgentKeyDict"]["DESKTOP----;ND"]=True
Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="ND", inADStr="", inADIsDefaultBool=True, inURLList=[], inRoleHierarchyAllowedDict=lUACClientDict)
# TEST Add User IMaslov - Add Login IMaslov to superuser of the Orchestrator
Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="IMaslov", inADStr="", inADIsDefaultBool=True, inURLList=[])
# TEST Add Supertoken for the all access between robots
Orchestrator.UACSuperTokenUpdate(inGSettings=gSettings, inSuperTokenStr="1992-04-03-0643-ru-b4ff-openrpa52zzz")
# INFO Relative/Absolute import see below - after settings init
# Template for import CP - Control Panels
# ATTENTION - Pay attention to CP names! Orchestrator is one for the all control panels per one machine
## !!! For Absolute import control panels !!!
# try:
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# import pyRobot_CP
# pyRobot_CP.SettingsUpdate(inGSettings=gSettings)
# except Exception as e:
# gSettings["Logger"].exception(f"Exception when init CP. See below.")
## !!! For Relative import control panels !!!
# try:
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# from pyRobot_CP import ControlPanel
# ControlPanel.SettingsUpdate(inGSettings=gSettings)
# except Exception as e:
# gSettings["Logger"].exception(f"Exception when init CP. See below.")
## !!! For Relative import !!! CP Version Check
try:
sys.path.insert(0,os.path.abspath(os.path.join(r"")))

@ -0,0 +1,49 @@
# 5. UAC - User Access Control
## About
Orchestrator has mega feature - user access control (UAC). This feature allow you to manipulate access of the web UI for the all users!
If you need to give admin rights - you dont customize UAC dict.
If you need to give some little rights for user only for one robot in orchestrator web panel - you can set the following properties in UAC dict.
To work with UAC you can use defs `Orchestrator.UAC` group.
## UAC Dict for Orchestrator WEB UI rights
UAC Dict for pyOpenRPA Orchestrator WEB UI rights.
```
"pyOpenRPADict":{
"CPKeyDict":{ # Empty dict - all access
# "CPKeyStr"{
# }
},
"RDPKeyDict":{ # Empty dict - all access
#"RDPKeyStr"{
# "FullscreenBool": True,
# "IgnoreBool":True,
# "ReconnectBool": True
# "NothingBool": True # USe option if you dont want to give some access to the RDP controls
# }
},
"AgentKeyDict": { # Empty dict - all access
# "AgentKeyStr"{
# }
},
"AdminDict":{ # Empty dict - all access
"LogViewerBool":True, # Show log viewer on the web page
"CMDInputBool":True, # Execute CMD on the server side and result to the logs
"ScreenshotViewerBool":True, # Show button to look screenshots
"RestartOrchestratorBool": True, # Restart orchestrator activity
"RestartOrchestratorGITPullBool": True, # Turn off (RDP remember) orc + git pull + Turn on (rdp remember)
"RestartPCBool": True, # Send CMD to restart pc
"NothingBool":True # USe option if you dont want to give some access to the RDP controls
},
"ActivityDict": { # Empty dict - all access
"ActivityListExecuteBool": True, # Execute activity at the current thread
"ActivityListAppendProcessorQueueBool": True # Append activity to the processor queue
}
}
```

@ -1,6 +1,6 @@
# 3. How to use
The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in OpenRPA.
The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in pyOpenRPA.
## How to execute RPA script
@ -28,7 +28,7 @@ import keyboard #[Keyboard manipulation](https://gitlab.com/UnicodeLabs/OpenRPA/
### Execute python script
The OpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
The pyOpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
- Execute in python x32 (OpenRPAResourcesWPy32-3720python-3.7.2)
- Execute in python x64 (OpenRPAResourcesWPy64-3720python-3.7.2.amd64)
- Execute from .cmd file

@ -8,7 +8,9 @@ contain the root `toctree` directive. -->
![image](img/ModalGuide.png)
*by Ivan Maslov (Russia)*
*by Ivan Maslov (Russia)* - see 3. Copyrights & Contacts.
! ATTENTION ! pyOpenRPA works only on MS Windows 7+/Server 2008+. Guys from Unix/Mac - sorry. We will come to you soon :)
## Donate
@ -28,9 +30,37 @@ The pyOpenRPA is based on Python and using well known OpenSource solutions such
The pyOpenRPA is distributed under the MIT license which allows you to use it in any way you want and any time you need without any restrictions.
At the time of this writing the pyOpenRPA is successfully using in several big Russian companies. Companies in which it was decided to develop own RPA division with no dependencies on expensive licenses.
## Structure
## Repo structure
The description of the each folder in GitLab repo is going below:
* **Agent**: template build for the pyOpenRPA.Agent component
* **Orchestrator**: template build for the pyOpenRPA.Orchestrator component
* **Resources**: 3rd party resources which is needed to provide pyOpenRPA encapsulation from the Operating System (OS) dependencies.
* **Robot**: template build for the robot
* **Sources**: pyOpenRPA python package sources + sphinx sources
### The pyOpenRPA has 3 main tools:
* **Studio**: build for the pyOpenRPA.Studio which support Desktop UI (support x32 and x64 desktop UI apps)
* **Utils**: many additional good tools for the python developer
* **Wiki**: compiled wiki documentation
## The pyOpenRPA structure
### The pyOpenRPA has 4 main tools:
* Studio
@ -41,9 +71,12 @@ At the time of this writing the pyOpenRPA is successfully using in several big R
* Orchestrator
* Agent
### Studio
Studio tool has been developed to help RPA-tors to create the robot algorythms.
The pyOpenRPA.Studio tool has been developed to help RPA-tors to create the robot algorythms.
**Features**
@ -64,7 +97,7 @@ Studio tool has been developed to help RPA-tors to create the robot algorythms.
### Robot
The Robot tool is the core of any action execution in the pyOpenRPA. All action from algorythms are perfoming by the Robot tool. It looks like a console process without graphic user interface.
The pyOpenRPA.Robot package is the core of any action execution in the pyOpenRPA. All action from algorythms are perfoming by the Robot tool. It looks like a console process without graphic user interface.
**Features**
@ -88,12 +121,12 @@ The Robot tool is the core of any action execution in the pyOpenRPA. All action
### Orchestrator
The Orchestrator tool has been developed to maintain robot infrastructure (2+ robots algorythm).
The pyOpenRPA.Orchestrator package has been developed to maintain robot infrastructure (2+ robots algorythm).
**Features**
* Start/Stop robot algorythm
* Start/Stop robot algorithm
* Robot scheduler
@ -107,32 +140,92 @@ The Orchestrator tool has been developed to maintain robot infrastructure (2+ ro
* Remote machine logs storage
## Guide (in progress)
### Agent
The pyOpenRPA.Agent tool has been developed to maintain robot infrastructure (2+ robots algorythm).
**Features**
* Send CMD to the RPA GUI session (start/safe stop/force stop/logout)
In wiki you can find:
in QUEUE
* Get screenshots from the RPA GUI session
* Theory & practice: Web app access (Chrome, Firefox, Opera)
* Get the list of the running processes
* Theory & practice: Desktop app UI access (win32 and UI automation dlls)
## Wiki structure
In wiki you can use the following docs:
* Theory & practice: Keyboard & mouse manipulation
* ENG Guide HTML [
* Theory & practice: Screen capture & image recognition
```
|OPEN GITLAB|
```
## Tutorials
]([https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/html/index.html](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/html/index.html))
* [ENG] Content in progress
* ENG Guide MarkDown [
```
|OPEN GITLAB|
```
* [RUS] Перейти в раздел туториалов
]([https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/markdown/index.md](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/ENG_Guide/markdown/index.md))
## Content
* ENG Guide PDF [
```
|WAIT|
```
]()
* RUS Article: Less cost - no paid RPA [
```
|OPEN HABR|
```
]([https://habr.com/ru/post/509644/](https://habr.com/ru/post/509644/))
* RUS Tutorial Desktop UI [
```
|OPEN HABR|
```
]([https://habr.com/ru/post/509644/](https://habr.com/ru/post/509644/)); [
```
|OPEN GITLAB|
```
]([https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/DesktopGUI_Habr/index.md](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/DesktopGUI_Habr/index.md))
* RUS Tutorial Web UI [
```
|OPEN HABR|
```
]([https://habr.com/ru/post/515310/](https://habr.com/ru/post/515310/)); [
```
|OPEN GITLAB|
```
]([https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/WebGUI_Habr/readme.md](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/WebGUI_Habr/readme.md))
## Guide content
* 1. How to install
@ -276,4 +369,13 @@ in QUEUE
* 3. gSettings Template
* 4. How to start process
* 4. How to use
* 5. UAC - User Access Control
* About
* UAC Dict for Orchestrator WEB UI rights

@ -1,11 +1,11 @@
# Навигация по статьям
Так как [pyOpenRPA](https://gitlab.com/UnicodeLabs/OpenRPA) - это достаточно крупная RPA платформа: туториал будет составлен в виде серий статей, в которых будут освещаться ключевые технологии. А уже освоив эти технологии, у вас появится возможность углубиться в то, что вам нужно.
Так как [pyOpenRPA](https://gitlab.com/UnicodeLabs/OpenRPA) - это крупная RPA платформа: туториал будет составлен в виде серий статей, в которых будут освещаться ключевые технологии. А уже освоив эти технологии, у вас появится возможность углубиться в то, что вам нужно.
**Ниже приведу планируемый перечень статей по этой тематике (для навигации):**
- [pyOpenRPA туториал. Управление оконными GUI приложениями](DesktopGUI_Habr/README.md)
- pyOpenRPA туториал. Управление WEB приложениями (то, что мы смотрим в Chrome, Firefox, Opera)
- [pyOpenRPA туториал. Управление WEB приложениями (то, что мы смотрим в Chrome, Firefox, Opera)](WebGUI_Habr/README.md)
- pyOpenRPA туториал. Управление клавиатурой & мышью
- pyOpenRPA туториал. Распознавание графических объектов на экране

@ -0,0 +1,503 @@
Долгожданный туториал по управлению сторонними WEB приложениями с помощью pyOpenRPA. Во 2-й части мы разберем принципы роботизированного воздействия на HTML/JS. А также своими руками сделаем небольшого, но очень показательного робота.
Этот робот будет полезен тем, для кого актуальна тема покупки/продажи недвижимости.
![pyOpenRPA туториал. Управление WEB приложениями](https://habrastorage.org/webt/gt/rq/mo/gtrqmo2cvzjaajye98dlpvxo-_u.png)
# Для тех, кто с нами впервые
[pyOpenRPA](https://gitlab.com/UnicodeLabs/OpenRPA) - это open source [RPA платформа](https://ru.wikipedia.org/wiki/Robotic_process_automation), которая **в полной мере позволяет заменить топовые коммерческие RPA платформы**.
Подробнее про то, чем же она полезна, можно [почитать здесь](https://habr.com/ru/post/506766/).
# Навигация по туториалам pyOpenRPA
Туториал сверстан в виде серии статей, в которых будут освещаться ключевые технологии, необходимые для RPA.
Освоив эти технологии, у вас появится возможность углубиться в специфику той задачи, которая поставлена перед вами.
**Перечень статей-туториалов (опубликованные и планируемые):**
- [Отказываемся от платных RPA платформ и базируемся на OpenSource (pyOpenRPA)](https://habr.com/ru/post/506766/)
- [pyOpenRPA туториал. Управление оконными GUI приложениями](https://habr.com/ru/post/509644/)
- \>> [pyOpenRPA туториал. Управление WEB приложениями (то, что мы смотрим в Chrome, Firefox, Opera)](https://habr.com/ru/post/515310/)
- pyOpenRPA туториал. Управление клавиатурой & мышью
- pyOpenRPA туториал. Распознавание графических объектов на экране
А теперь перейдем к самому туториалу.
<cut/>
# Немного теории и терминов
[Из википедии]
Веб-приложение — клиент-серверное приложение, в котором клиент взаимодействует с веб-сервером при помощи браузера. Логика веб-приложения распределена между сервером и клиентом, хранение данных осуществляется, преимущественно, на сервере, обмен информацией происходит по сети. Одним из преимуществ такого подхода является тот факт, что клиенты не зависят от конкретной операционной системы пользователя, поэтому веб-приложения являются межплатформенными службами.
Веб приложения стали широко использоваться в конце 1990-х — начале 2000-х годов.
[Ссылка на источник](https://ru.wikipedia.org/wiki/%D0%92%D0%B5%D0%B1-%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5)
Ок, с выдержкой из вики все #КрутоУмно, но от этого не легче (для тех, кто в этой теме дилетант). Продемонстрирую устройство WEB приложения на примере "Что видим мы?"/"Что видит робот?". Для этого отправимся на сайт одной известной WEB площадки по объявлениям по недвижимости
## Что видим мы?
Мы видим красиво сверстанный сайт с интуитивно понятным интерфейсом, на котором можно найти интересные объявления о продаже/сдаче в аренду недвижимости.
![Как мы видим WEB приложение](https://habrastorage.org/webt/af/sf/ku/afsfkuhlchm-prpeh_-hzrachmw.png)
## Что видит робот?
Робот видит огромную гипертекстовую разметку [HTML](https://ru.wikipedia.org/wiki/HTML) с примесью алгоритмического кода [JS](https://ru.wikipedia.org/wiki/JavaScript) и завернутого в каскадную таблицу стилей [CSS](https://ru.wikipedia.org/wiki/CSS). Увлекательно, правда? :)
![Как робот видит WEB приложение](https://habrastorage.org/webt/gz/15/hy/gz15hycrdih3s9paxjsuocsnq6e.png)
## Интерпретация
WEB приложения - это **один из самых легко роботизируемых классов приложений**. Обилие инструментов + технологий позволяют реализовывать практически любую поставленную задачу в кооперации с ними.
Управлять WEB страницей можно с помощью разных технологий адресации: CSS, XPath, id, class, attribute. Мы будем взаимодействовать со страницей с помощью CSS селекторов.
<cut/>
# (По шагам) робот своими руками
В этом туториале мы будем заниматься разработкой робота, который оперирует на одном из самых популярных порталов по объявлениям по недвижимости в РФ (тема одна из актуальных для многих).
В качестве примера поставим себе следующую задачу: **Разработать робота, который будет извлекать список всех объявлений по ранее преднастроенному фильтру**. Все извлеченные объявления сохранить как датасет в файл .json со следующей структурой:
```
{
"SearchKeyStr": "МСК_Тверской", # Ключевое слово поиска
"SearchTitleStr": "Москва, район Тверской", # Заголовок поиска
"SearchURLStr": "https://www.cian.ru/cat.php?deal_type=sale&engine_version=2&in_polygon%5B1%5D=37.6166_55.7678%2C37.6147_55.7688%2C37.6114_55.7694%2C37.6085_55.7698%2C37.6057_55.77%2C37.6018_55.77%2C37.5987_55.77%2C37.5961_55.7688%2C37.5942_55.7677%2C37.5928_55.7663%2C37.5915_55.7647%2C37.5908_55.7631%2C37.5907_55.7616%2C37.5909_55.7595%2C37.5922_55.7577%2C37.5944_55.7563%2C37.5968_55.7555%2C37.6003_55.7547%2C37.603_55.7543%2C37.6055_55.7542%2C37.6087_55.7541%2C37.6113_55.7548%2C37.6135_55.756%2C37.6151_55.7574%2C37.6163_55.7589%2C37.6179_55.7606%2C37.6187_55.7621%2C37.619_55.7637%2C37.6194_55.7651%2C37.6193_55.7667%2C37.6178_55.7679%2C37.6153_55.7683%2C37.6166_55.7678&offer_type=flat&polygon_name%5B1%5D=%D0%9E%D0%B1%D0%BB%D0%B0%D1%81%D1%82%D1%8C+%D0%BF%D0%BE%D0%B8%D1%81%D0%BA%D0%B0&room1=1&room2=1", # URL of the CIAN search [str]
"SearchDatetimeStr": "2020-08-01 09:33:00.838081", # Дата, на которую была сформирована выгрузка
"SearchItems": { # Перечень извлеченных ценовых объявлений
"https://www.cian.ru/sale/flat/219924574/:": { # URL ссылка на ценовое объявление
"TitleStr": "3-комн. кв., 31,4 м², 5/8 этаж", # Заголовок ценового объявления
"PriceFloat": 10000000.0, # Стоимость общая
"PriceSqmFloat": 133333.0, # Стоимость на 1 кв. м.
"SqMFloat": 31.4, # Кол-во кв. м.
"FloorCurrentInt": 5, # Этаж лота по объявлению
"FloorTotalInt": 8, # Этажей в доме всего
"RoomCountInt": 3 # Кол-во комнат
}
}
}
```
<cut/>
## Шаг 0. Подготовим проект для нового робота (развернем pyOpenRPA)
В отличии от подавляющего большинства RPA платформ, в pyOpenRPA реализован принципиально иной подход по подключению к проекту, а именно: если в них структуру проекта определяет сама RPA платформа, то в pyOpenRPA структуру проекта определяете Вы и только Вы. Это дает больше гибкости и возможности по использованию этой RPA технологии в других направлениях (использовать pyOpenRPA как обычную библиотеку Python).
**Доступно несколько вариантов загрузки [pyOpenRPA](https://gitlab.com/UnicodeLabs/OpenRPA):**
- Вариант 1, простой. Скачать преднастроенную портативную версию с [GitLab страницы проекта](https://gitlab.com/UnicodeLabs/OpenRPA)
- Вариант 2, сложный. Установить pyOpenRPA в свою версию интерпретатора Python 3 (pip install pyOpenRPA)
Я рекомендую воспользоваться простым вариантом (вариант 1). Преднастроенная версия не требуется каких-либо настроек инфраструктуры. Здесь в лучших традициях pyOpenRPA реализован принцип, когда пользователь скачивает репозиторий, и у него уже все настроено из коробки - пользователю остается лишь писать скрипт робота. #Enjoy :)
<cut/>
## Шаг 1. Создать проект робота
Для того, чтобы начать проект робота, необходимо создать папку проекта. В дальнейшем я затрону тему организации папок проектов для промышленных программных роботов. Но на текущий момент не буду заострять внимание на этом, чтобы сконцентрироваться непосредственно на основном - на логике работы с WEB страницами.
**Ниже приведу зависимости проекта от сторонних компонентов:**
- Selenium WebDriver
- Google Chrome или Mozilla Firefox или Internet Explorer
- Python 3
Если вы пошли по варианту 1 (см. шаг 0), то у Вас все эти компоненты уже будут развернуты и настроены внутри скачанного репозитория pyOpenRPA (#Удобно). Репозиторий pyOpenRPA уже содержит все необходимые portable версии требуемых программ (Google Chrome, Mozilla Firefox, Python3 32|64 и т.д.).
Вы наверняка заметили, что в pyOpenRPA используется [Selenium](https://habr.com/ru/post/152653/). Этот компонент является одним из лучших отказоустойчивых компонентов по внедрению в WEB. Именно поэтому мы его и будем использовать в pyOpenRPA.
**Создадим следующую структуру проекта:**
- Репозиторий pyOpenRPA > Wiki > RUS_Tutorial > WebGUI_Habr:
- Файл "3. MonitoringCIAN_Run_64.py" - скрипт робота, который мониторит WEB площадку
- Файл "3. MonitoringCIAN_Run_64.cmd" - скрипт запуска робота с 1-го клика по аналогии с .exe файлами
**Ниже приведу пример "3. MonitoringCIAN_Run_64.cmd" файла:**
```
cd %~dp0..\..\..\Sources
..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe "..\Wiki\RUS_Tutorial\WebGUI_Habr\3. MonitoringCIAN_Run_64.py"
pause >nul
```
**Для инициализации Selenium WebDriver воспользуемся следующей функцией:**
```
##########################
# Init the Chrome web driver
###########################
def WebDriverInit(inWebDriverFullPath, inChromeExeFullPath, inExtensionFullPathList):
# Set full path to exe of the chrome
lWebDriverChromeOptionsInstance = webdriver.ChromeOptions()
lWebDriverChromeOptionsInstance.binary_location = inChromeExeFullPath
# Add extensions
for lExtensionItemFullPath in inExtensionFullPathList:
lWebDriverChromeOptionsInstance.add_extension (lExtensionItemFullPath)
# Run chrome instance
lWebDriverInstance = None
if inWebDriverFullPath:
# Run with specified web driver path
lWebDriverInstance = webdriver.Chrome(executable_path = inWebDriverFullPath, options=lWebDriverChromeOptionsInstance)
else:
lWebDriverInstance = webdriver.Chrome(options = lWebDriverChromeOptionsInstance)
# Return the result
return lWebDriverInstance
```
<cut/>
## Шаг 2. Запустить WEB инструменты разработчика и сформировать CSS селекторы
В нашем случае WEB инструменты разработчика мы будем использовать из Google Chrome, который предустановлен в репозитории pyOpenRPA (вариант 1 из шага 0).
**Откроем Google Chrome и инструменты разработчика** (pyOpenRPA repo\\Resources\GoogleChromePortable\App\Chrome-bin\chrome.exe, после чего Ctrl + Shift + i)
![Portable Google Chrome + Dev Tools](https://habrastorage.org/webt/2p/nq/pc/2pnqpcdew_gkdrsvc2rhya1wc8k.png)
**Откроем в браузере сайт, который мы будем анализировать. Сформируем область поиска и отобразить обнаруженные ценовые предложения в виде списка.**
[Пример поискового запроса](https://www.cian.ru/cat.php?deal_type=sale&engine_version=2&in_polygon%5B1%5D=37.6166_55.7678%2C37.6147_55.7688%2C37.6114_55.7694%2C37.6085_55.7698%2C37.6057_55.77%2C37.6018_55.77%2C37.5987_55.77%2C37.5961_55.7688%2C37.5942_55.7677%2C37.5928_55.7663%2C37.5915_55.7647%2C37.5908_55.7631%2C37.5907_55.7616%2C37.5909_55.7595%2C37.5922_55.7577%2C37.5944_55.7563%2C37.5968_55.7555%2C37.6003_55.7547%2C37.603_55.7543%2C37.6055_55.7542%2C37.6087_55.7541%2C37.6113_55.7548%2C37.6135_55.756%2C37.6151_55.7574%2C37.6163_55.7589%2C37.6179_55.7606%2C37.6187_55.7621%2C37.619_55.7637%2C37.6194_55.7651%2C37.6193_55.7667%2C37.6178_55.7679%2C37.6153_55.7683%2C37.6166_55.7678&offer_type=flat&polygon_name%5B1%5D=%D0%9E%D0%B1%D0%BB%D0%B0%D1%81%D1%82%D1%8C+%D0%BF%D0%BE%D0%B8%D1%81%D0%BA%D0%B0&room1=1&room2=1)
![Список ценовых предложений по фильтру](https://habrastorage.org/webt/qc/sp/po/qcspporaxqux_kcimoncngnjtcg.png)
Для того, чтобы подобрать CSS селектор нам помогут инструменты разработчика Google Chrome. Подробнее узнать про устройство CSS селекторов можно [здесь по ссылке](https://learn.javascript.ru/css-selectors)
Для проверки правильности CSS селектора я буду делать следующую проверку в инструментах разработчика на вкладке "Console". На картинке представлен пример того, как проводится проверки правильности CSS селектора для извлечения списка ценовых предложений.
![Пример проверки CSS селектора](https://habrastorage.org/webt/o-/zy/x9/o-zyx9fqur5fq6mu1xedb7srskg.png)
**Подберем CSS селектор для выборки списка ценовых предложений на странице.**
При составлении селектора выяснилось, что в список объявлений встроены рекламные баннеры, которые не содержат информацию о ценовом предложении.
И таких видов рекламных баннеров было обнаружено несколько видов:
- div[data-name="BannerServicePlaceInternal"]
- div[data-name="getBannerMarkup"]
- div[data-name="AdFoxBannerTracker"]
В связи с этим CSS селектор должен быть скорректирован таким образом, чтобы исключить из выборки такие виды баннеров. Ниже приведен готовый CSS селектор.
- CSS селектор, Список ценовых предложений: div[data-name="Offers"] > div:not([data-name="BannerServicePlaceInternal"]):not([data-name="getBannerMarkup"]):not([data-name="AdFoxBannerTracker"])
**Подберем CSS селекторы по извлечению параметров ценового предложения: Заголовок, Стоимость общая, URL ссылка на карточку.**
- CSS селектор, Заголовок: div[data-name="TopTitle"],div[data-name="Title"]
- CSS селектор, Стоимость общая: div[data-name="Price"] > div[class*="header"],div[data-name="TopPrice"] > div[class*="header"]
- CSS селектор, URL ссылка на карточку: a[class*="--header--"]
**Подберем CSS селектор для извлечения кнопки на следующую страницу.**
- CSS селектор, Указатель на следующую страницу: div[data-name="Pagination"] li[class*="active"] + li a
<cut/>
## Шаг 3. Обработать/преобразовать получаемые данные
На предыдущем шаге мы успешно подобрали все необходимые CSS селекторы. Теперь нам нужно грамотно извлечь информацию, а потом и обработать ее.
В результате обработки ценового предложения у нас будет сформирована структура следующего вида:
```
lOfferItemInfo = { # Item URL with https
"TitleStr": "3-комн. кв., 31,4 м², 5/8 этаж", # Offer title [str]
"PriceFloat": 10000000.0, # Price [float]
"PriceSqmFloat": 133333.0, # CALCULATED Price per square meters [float]
"SqMFloat": 31.4, # Square meters in flat [float]
"FloorCurrentInt": 5, # Current floor [int]
"FloorTotalInt": 8, # Current floor [int]
"RoomCountInt": 3 # Room couint [int]
}
```
**Для начала получим список элементов ценовых предложений.**
```
lOfferListCSSStr = 'div[data-name="Offers"] > div:not([data-name="BannerServicePlaceInternal"]):not([data-name="getBannerMarkup"]):not([data-name="AdFoxBannerTracker"])'
lOfferList = inWebDriver.find_elements_by_css_selector(css_selector=lOfferListCSSStr)
```
**Далее циклическая обработка каждого ценового предложения.**
```
for lOfferItem in lOfferList:
```
**Извлечем параметры из WEB страницы: Заголовок, Стоимость общая, URL на карточку.**
```
lTitleStr = lOfferItem.find_element_by_css_selector(css_selector='div[data-name="TopTitle"],div[data-name="Title"]').text # Extract title text
lPriceStr = lOfferItem.find_element_by_css_selector(css_selector='div[data-name="Price"] > div[class*="header"],div[data-name="TopPrice"] > div[class*="header"]').text # Extract total price
lURLStr = lOfferItem.find_element_by_css_selector(css_selector='a[class*="--header--"]').get_attribute("href") # Extract offer URL
lOfferItemInfo["TitleStr"] = lTitleStr # set the title
lPriceStr = lPriceStr.replace(" ","").replace("₽","") # Remove some extra symbols
lOfferItemInfo["PriceFloat"] = round(float(lPriceStr),2) # Convert price to the float type
```
**Извлечем недостающие параметры алгоритмическим путем.**
- Если в заголовке **содержится** слово "Апартаменты"
```
lREResult = re.search(r".*, (\d*,?\d*) м², (\d*)/(\d*) эта.", lTitleStr) # run the re
lOfferItemInfo["RoomCountInt"] = 1 # Room count
lSqmStr = lREResult.group(1)
lSqmStr= lSqmStr.replace(",",".")
lOfferItemInfo["SqMFloat"] = round(float(lSqmStr),2) # sqm count
lOfferItemInfo["FloorCurrentInt"] = int(lREResult.group(2)) # Floor current
lOfferItemInfo["FloorTotalInt"] = int(lREResult.group(3)) # Floor total
lOfferItemInfo["PriceSqmFloat"] = round(lOfferItemInfo["PriceFloat"] / lOfferItemInfo["SqMFloat"],2) # Sqm per M
```
- Если в заголовке **не содержится** слово "Апартаменты"
```
lREResult = re.search(r".*(\d)-комн. .*, (\d*,?\d*) м², (\d*)/(\d*) эта.", lTitleStr) # run the re
lOfferItemInfo["RoomCountInt"] = int(lREResult.group(1)) # Room count
lSqmStr = lREResult.group(2)
lSqmStr= lSqmStr.replace(",",".")
lOfferItemInfo["SqMFloat"] = round(float(lSqmStr),2) # sqm count
lOfferItemInfo["FloorCurrentInt"] = int(lREResult.group(3)) # Floor current
lOfferItemInfo["FloorTotalInt"] = int(lREResult.group(4)) # Floor total
lOfferItemInfo["PriceSqmFloat"] = round(lOfferItemInfo["PriceFloat"] / lOfferItemInfo["SqMFloat"],2) # Sqm per M
```
В примере выше применяется магия [регулярных выражений](https://ru.wikipedia.org/wiki/%D0%A0%D0%B5%D0%B3%D1%83%D0%BB%D1%8F%D1%80%D0%BD%D1%8B%D0%B5_%D0%B2%D1%8B%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F)
Для подбора правильных регулярных выражений я пользуюсь [online валидаторами типа таких](https://www.google.com/search?q=online+regex&oq=online+reg&aqs=chrome.0.0l2j69i57j0l5.5699j0j7&sourceid=chrome&ie=UTF-8)
**По окончанию обработки ценовых предложений выполним проверку на наличие указателя на следующую страницу, и (если такой указатель имеется) выполним переход на нее.**
Выше (на шаге 2) мы уже находили CSS селектор указателя на следующую страницу. Нам нужно выполнить действие клика .click() по этому элементу.
Но при тестировании выяснилось, что функция .click от Selenium отрабатывает некорректно для этой страницы (не происходит переключение). В связи с этим у нас есть уникальная возможность использовать функциональность JavaScript на самой странице через Selenium. А уже из JavaScript выяснилось, что функция нажатия по указателю страницы отрабатывает корректно. Для этого выполним следующую команду:
```
inWebDriver.execute_script("""document.querySelector('div[data-name="Pagination"] li[class*="active"] + li a').click()""")
```
После того как был отправлен сигнал на переключение страницы, необходимо дождаться ее загрузки. Только после появления новой страницы мы сможем перейти к обработке новых ценовых предложений.
```
# wait while preloader is active
lDoWaitBool = True
while lDoWaitBool:
lPreloaderCSS = inWebDriver.find_elements_by_css_selector(css_selector='div[class*="--preloadOverlay--"]') # So hard to catch the element :)
if len(lPreloaderCSS)>0: time.sleep(0.5) # preloader is here - wait
else: lDoWaitBool = False # Stop wait if preloader is dissappear
```
**Итоговую структуру сохраним в .json файл.**
```
# Check dir - create if not exists
if not os.path.exists(os.path.join('Datasets',lResult['SearchKeyStr'])):
os.makedirs(os.path.join('Datasets',lResult['SearchKeyStr']))
# Save result in file
lFile = open(f"{os.path.join('Datasets',lResult['SearchKeyStr'],lDatetimeNowStr.replace(' ','_').replace('-','_').replace(':','_').replace('.','_'))}.json","w",encoding="utf-8")
lFile.write(json.dumps(lResult))
lFile.close()
```
## Шаг 4. Обработка нештатных ситуаций
Этап тестирования - это один из самых важных этапов, который позволяет конвертировать вложенные усилия в реальный эффект. При тестировании кода на этом WEB приложении выяснилось, что могут происходить некоторые сбои. Ниже привожу те виды сбоев, которые встретились у меня:
- Зависает ползунок загрузки при переключении на сл. страницу
- При переключении на следующую страницу открывается совсем не следующая страница (иногда, но случалось :) )
Но роботы не боятся таких проблем (на то они и роботы :) ).
**Для каждого вида сбоя мы предусмотрим сценарий восстановления, который позволит роботы доделать свою работу до конца.**
- Зависает ползунок загрузки при переключении на сл. страницу
```
# wait while preloader is active. If timeout - retry all job
lTimeFromFLoat = time.time() # get current time in float (seconds)
lDoWaitBool = True
while lDoWaitBool:
lPreloaderCSS = inWebDriver.find_elements_by_css_selector(css_selector='div[class*="--preloadOverlay--"]')
if len(lPreloaderCSS)>0: time.sleep(0.5) # preloader is here - wait
else: lDoWaitBool = False # Stop wait if preloader is dissappear
if (time.time() - lTimeFromFLoat) > 15: # check if timeout is more than 15 seconds
lRetryJobBool = True # Loading error on page - do break, then retry the job
if inLogger: inLogger.warning(f"Ожидание загрузки страницы более {15} с., Робот повторит задание сначала")
break # break the loop
if lRetryJobBool == True: # break the loop if RetryJobBool is true
break
```
- При переключении на следующую страницу открывается совсем не следующая страница (иногда, но случалось :) )
```
lPageNumberInt = int(inWebDriver.find_element_by_css_selector(css_selector='li[class*="--active--"] span').text) # Get the current page int from web and check with iterator (if not equal - retry all job)
if lPageNumberInt == lPageCounterInt:
... Код робота ...
else:
lRetryJobBool = True
if inLogger: inLogger.warning(
f"Следующая страница по списку не была загружена. Была загружена страница: {lPageNumberInt}, Ожидалась страница: {lPageCounterInt}")
```
## Шаг 5. Консолидировать код в проекте робота
**Соберем все блоки воедино.**
Получим следующий пакет ([открыть на GitLab](https://gitlab.com/UnicodeLabs/OpenRPA/-/blob/master/Wiki/RUS_Tutorial/WebGUI_Habr/3.%20MonitoringCIAN_Run_64.py)):
```
# Init Chrome web driver with extensions (if applicable)
# Import section
from selenium import webdriver
import time
import re # Regexp to extract info from string
import json
import datetime
import os
import re
import copy
import logging
# Store structure (.json)
"""
{
"SearchKeyStr": "МСК_Тверской",
"SearchTitleStr": "Москва, район Тверской", # Title of the search [str]
"SearchURLStr": "https://www.cian.ru/cat.php?deal_type=sale&engine_version=2&in_polygon%5B1%5D=37.6166_55.7678%2C37.6147_55.7688%2C37.6114_55.7694%2C37.6085_55.7698%2C37.6057_55.77%2C37.6018_55.77%2C37.5987_55.77%2C37.5961_55.7688%2C37.5942_55.7677%2C37.5928_55.7663%2C37.5915_55.7647%2C37.5908_55.7631%2C37.5907_55.7616%2C37.5909_55.7595%2C37.5922_55.7577%2C37.5944_55.7563%2C37.5968_55.7555%2C37.6003_55.7547%2C37.603_55.7543%2C37.6055_55.7542%2C37.6087_55.7541%2C37.6113_55.7548%2C37.6135_55.756%2C37.6151_55.7574%2C37.6163_55.7589%2C37.6179_55.7606%2C37.6187_55.7621%2C37.619_55.7637%2C37.6194_55.7651%2C37.6193_55.7667%2C37.6178_55.7679%2C37.6153_55.7683%2C37.6166_55.7678&offer_type=flat&polygon_name%5B1%5D=%D0%9E%D0%B1%D0%BB%D0%B0%D1%81%D1%82%D1%8C+%D0%BF%D0%BE%D0%B8%D1%81%D0%BA%D0%B0&room1=1&room2=1", # URL of the CIAN search [str]
"SearchDatetimeStr": "2020-08-01 09:33:00.838081", # Date of data extraction, [str]
"SearchItems": {
"https://www.cian.ru/sale/flat/219924574/:": { # Item URL with https
"TitleStr": "3-комн. кв., 31,4 м², 5/8 этаж", # Offer title [str]
"PriceFloat": 10000000.0, # Price [float]
"PriceSqmFloat": 133333.0, # CALCULATED Price per square meters [float]
"SqMFloat": 31.4, # Square meters in flat [float]
"FloorCurrentInt": 5, # Current floor [int]
"FloorTotalInt": 8, # Current floor [int]
"RoomCountInt": 3 # Room couint [int]
}
}
}
"""
##########################
# Init the Chrome web driver
###########################
gChromeExeFullPath = r'..\Resources\GoogleChromePortable\App\Chrome-bin\chrome.exe'
gExtensionFullPathList = []
gWebDriverFullPath = r'..\Resources\SeleniumWebDrivers\Chrome\chromedriver_win32 v84.0.4147.30\chromedriver.exe'
def WebDriverInit(inWebDriverFullPath, inChromeExeFullPath, inExtensionFullPathList):
# Set full path to exe of the chrome
lWebDriverChromeOptionsInstance = webdriver.ChromeOptions()
lWebDriverChromeOptionsInstance.binary_location = inChromeExeFullPath
# Add extensions
for lExtensionItemFullPath in inExtensionFullPathList:
lWebDriverChromeOptionsInstance.add_extension (lExtensionItemFullPath)
# Run chrome instance
lWebDriverInstance = None
if inWebDriverFullPath:
# Run with specified web driver path
lWebDriverInstance = webdriver.Chrome(executable_path = inWebDriverFullPath, options=lWebDriverChromeOptionsInstance)
else:
lWebDriverInstance = webdriver.Chrome(options = lWebDriverChromeOptionsInstance)
# Return the result
return lWebDriverInstance
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# def to extract list of offers from one job
def OffersByJobExtractDict(inLogger, inWebDriver, inJob):
# BUG 0 - if timeout - retry the job +
# BUG 1 - do mouse scroll to to emulate user activity - cian can hold the robot
# BUG 2 - check the page to retry job offer if page is not next +
# BUG 3 - RE fall on Апартаменты-студия, 85,6 м², 4/8 этаж +
lRetryJobBool = True # Init flag if some error is raised - retry
while lRetryJobBool:
lRetryJobBool = False # Set false until some another action will appear
lResult = copy.deepcopy(inJob) # do copy the structure
lFilterURLStr = lResult["SearchURLStr"]
inWebDriver.get(lFilterURLStr) # Open the URL
lDatetimeNowStr = str(datetime.datetime.now())
lResult.update({
"SearchDatetimeStr": lDatetimeNowStr, # Date of data extraction, [str]
"SearchItems": {} # prepare the result
})
# Get List of the page
lNextPageItemCSS = 'div[data-name="Pagination"] li[class*="active"] + li a'
lNextPageItem = inWebDriver.find_element_by_css_selector(lNextPageItemCSS)
lPageCounterInt = 1 # Init the page counter
while lNextPageItem:
lPageNumberInt = int(inWebDriver.find_element_by_css_selector(css_selector='li[class*="--active--"] span').text) # Get the current page int from web and check with iterator (if not equal - retry all job)
if lPageNumberInt == lPageCounterInt:
lOfferListCSSStr = 'div[data-name="Offers"] > div:not([data-name="BannerServicePlaceInternal"]):not([data-name="getBannerMarkup"]):not([data-name="AdFoxBannerTracker"])'
lOfferList = inWebDriver.find_elements_by_css_selector(css_selector=lOfferListCSSStr)
for lOfferItem in lOfferList: # Processing the item, extract info
lOfferItemInfo = { # Item URL with https
"TitleStr": "3-комн. кв., 31,4 м², 5/8 этаж", # Offer title [str]
"PriceFloat": 10000000.0, # Price [float]
"PriceSqmFloat": 133333.0, # CALCULATED Price per square meters [float]
"SqMFloat": 31.4, # Square meters in flat [float]
"FloorCurrentInt": 5, # Current floor [int]
"FloorTotalInt": 8, # Current floor [int]
"RoomCountInt": 3 # Room couint [int]
}
lTitleStr = lOfferItem.find_element_by_css_selector(css_selector='div[data-name="TopTitle"],div[data-name="Title"]').text # Extract title text
if inLogger: inLogger.info(f"Старт обработки предложения: {lTitleStr}")
lPriceStr = lOfferItem.find_element_by_css_selector(css_selector='div[data-name="Price"] > div[class*="header"],div[data-name="TopPrice"] > div[class*="header"]').text # Extract total price
lURLStr = lOfferItem.find_element_by_css_selector(css_selector='a[class*="--header--"]').get_attribute("href") # Extract offer URL
lOfferItemInfo["TitleStr"] = lTitleStr # set the title
lPriceStr = lPriceStr.replace(" ","").replace("₽","") # Remove some extra symbols
lOfferItemInfo["PriceFloat"] = round(float(lPriceStr),2) # Convert price to the float type
#Check if Апартаменты
if "АПАРТАМЕНТЫ" in lTitleStr.upper():
lREResult = re.search(r".*, (\d*,?\d*) м², (\d*)/(\d*) эта.", lTitleStr) # run the re
lOfferItemInfo["RoomCountInt"] = 1 # Room count
lSqmStr = lREResult.group(1)
lSqmStr= lSqmStr.replace(",",".")
lOfferItemInfo["SqMFloat"] = round(float(lSqmStr),2) # sqm count
lOfferItemInfo["FloorCurrentInt"] = int(lREResult.group(2)) # Floor current
lOfferItemInfo["FloorTotalInt"] = int(lREResult.group(3)) # Floor total
lOfferItemInfo["PriceSqmFloat"] = round(lOfferItemInfo["PriceFloat"] / lOfferItemInfo["SqMFloat"],2) # Sqm per M
else:
lREResult = re.search(r".*(\d)-комн. .*, (\d*,?\d*) м², (\d*)/(\d*) эта.", lTitleStr) # run the re
lOfferItemInfo["RoomCountInt"] = int(lREResult.group(1)) # Room count
lSqmStr = lREResult.group(2)
lSqmStr= lSqmStr.replace(",",".")
lOfferItemInfo["SqMFloat"] = round(float(lSqmStr),2) # sqm count
lOfferItemInfo["FloorCurrentInt"] = int(lREResult.group(3)) # Floor current
lOfferItemInfo["FloorTotalInt"] = int(lREResult.group(4)) # Floor total
lOfferItemInfo["PriceSqmFloat"] = round(lOfferItemInfo["PriceFloat"] / lOfferItemInfo["SqMFloat"],2) # Sqm per M
lResult['SearchItems'][lURLStr] = lOfferItemInfo # Set item in result dict
# Click next page item
lNextPageItem = None
lNextPageList = inWebDriver.find_elements_by_css_selector(lNextPageItemCSS)
if len(lNextPageList)>0:
lNextPageItem = lNextPageList[0]
try:
#lNextPageItem = WebDriverWait(lWebDriver, 10).until(EC.visibility_of_element_located((By.CSS_SELECTOR, 'div[data-name="Pagination"]')))
#lNextPageItem.click()
inWebDriver.execute_script("""document.querySelector('div[data-name="Pagination"] li[class*="active"] + li a').click()""")
except Exception as e:
print(e)
time.sleep(0.5) # some init operations
# wait while preloader is active. If timeout - retry all job
lTimeFromFLoat = time.time() # get current time in float (seconds)
lDoWaitBool = True
while lDoWaitBool:
lPreloaderCSS = inWebDriver.find_elements_by_css_selector(css_selector='div[class*="--preloadOverlay--"]')
if len(lPreloaderCSS)>0: time.sleep(0.5) # preloader is here - wait
else: lDoWaitBool = False # Stop wait if preloader is dissappear
if (time.time() - lTimeFromFLoat) > 15: # check if timeout is more than 15 seconds
lRetryJobBool = True # Loading error on page - do break, then retry the job
if inLogger: inLogger.warning(f"Ожидание загрузки страницы более {15} с., Робот повторит задание сначала")
break # break the loop
if lRetryJobBool == True: # break the loop if RetryJobBool is true
break
lPageCounterInt = lPageCounterInt + 1 # Increment the page counter
else:
lRetryJobBool = True
if inLogger: inLogger.warning(
f"Следующая страница по списку не была загружена. Была загружена страница: {lPageNumberInt}, Ожидалась страница: {lPageCounterInt}")
if lRetryJobBool == False: # break the loop if RetryJobBool is true
# Check dir - create if not exists
if not os.path.exists(os.path.join('Datasets',lResult['SearchKeyStr'])):
os.makedirs(os.path.join('Datasets',lResult['SearchKeyStr']))
# Save result in file
lFile = open(f"{os.path.join('Datasets',lResult['SearchKeyStr'],lDatetimeNowStr.replace(' ','_').replace('-','_').replace(':','_').replace('.','_'))}.json","w",encoding="utf-8")
lFile.write(json.dumps(lResult))
lFile.close()
# Инициализировать Google Chrome with selenium web driver
lWebDriver = WebDriverInit(inWebDriverFullPath = gWebDriverFullPath, inChromeExeFullPath = gChromeExeFullPath, inExtensionFullPathList = gExtensionFullPathList)
lFilterURLStr = "https://www.cian.ru/cat.php?deal_type=sale&engine_version=2&in_polygon%5B1%5D=37.6166_55.7678%2C37.6147_55.7688%2C37.6114_55.7694%2C37.6085_55.7698%2C37.6057_55.77%2C37.6018_55.77%2C37.5987_55.77%2C37.5961_55.7688%2C37.5942_55.7677%2C37.5928_55.7663%2C37.5915_55.7647%2C37.5908_55.7631%2C37.5907_55.7616%2C37.5909_55.7595%2C37.5922_55.7577%2C37.5944_55.7563%2C37.5968_55.7555%2C37.6003_55.7547%2C37.603_55.7543%2C37.6055_55.7542%2C37.6087_55.7541%2C37.6113_55.7548%2C37.6135_55.756%2C37.6151_55.7574%2C37.6163_55.7589%2C37.6179_55.7606%2C37.6187_55.7621%2C37.619_55.7637%2C37.6194_55.7651%2C37.6193_55.7667%2C37.6178_55.7679%2C37.6153_55.7683%2C37.6166_55.7678&offer_type=flat&polygon_name%5B1%5D=%D0%9E%D0%B1%D0%BB%D0%B0%D1%81%D1%82%D1%8C+%D0%BF%D0%BE%D0%B8%D1%81%D0%BA%D0%B0&room1=1&room2=1"
lJobItem = {
"SearchKeyStr": "МСК_Тверской",
"SearchTitleStr": "Москва, район Тверской", # Title of the search [str]
"SearchURLStr": lFilterURLStr,
# URL of the CIAN search [str]
}
OffersByJobExtractDict(inLogger = logging, inWebDriver = lWebDriver, inJob = lJobItem)
```
<cut/>
# Подведем итоги
Уважаемые роботизаторы.
Мы успешно преодолели вторую серию туториалов по созданию роботов в WEB приложениях с помощью open source pyOpenRPA. Готовый проект робота Вы можете найти в репозитории pyOpenRPA [по ссылочке](https://gitlab.com/UnicodeLabs/OpenRPA/-/tree/master/Wiki/RUS_Tutorial/WebGUI_Habr).
В нашем аресенале уже имеются изученные технологии упраления Desktop и WEB приложениями. В следующей статье-туториале мы остановимся на особенностях роботизированного управления мышью и клавиатурой.
Пишите комменты, внедряйте бесплатных роботов, будьте счастливы :)
**До скорых публикаций!**
Loading…
Cancel
Save