bas-remote-python


Namebas-remote-python JSON
Version 1.6 PyPI version JSON
download
home_pagehttps://github.com/CheshireCaat/bas-remote-python
SummaryPython library, which allows you to automate Google Chrome browser.
upload_time2024-08-28 00:09:36
maintainerNone
docs_urlNone
authorCheshireCaat
requires_python>=3.7
licenseMIT
keywords visual-programming-language browserautomationstudio bas-remote-control bas-remote-client bot-framework bas-remote bas-client automation chromium imacros windows desktop browser grabber poster macros bas ide cef bot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # bas-remote-python

[![PyPI version](https://badge.fury.io/py/bas-remote-python.svg)](https://badge.fury.io/py/bas-remote-python)
[![GitHub issues](https://img.shields.io/github/issues/CheshireCaat/bas-remote-python)](https://github.com/CheshireCaat/bas-remote-python/issues)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**bas-remote-python** - Python library, which allows you to **automate Google Chrome browser**.

In order to make it possible, BrowserAutomationStudio application is used. **bas-remote-python** allows you to call and control execution of functions created in BAS. Consider following example, you have a BAS function, which executes specified Google search query and returns result as a list of urls. Using this library, you can call that function in any Python application and obtain result. You can distribute applications written with **bas-remote-python** library as well.

# BrowserAutomationStudio

**BAS** - is application that allows you to automate any activities in Google Chrome browser with a help of visual programming and without knowing of any programming language. You can think of it as IDE created especially for browser automation:

![](https://bablosoft.com/landing2/screen-bas.png)

Check following link for more info:

[https://bablosoft.com/shop/BrowserAutomationStudio](https://bablosoft.com/shop/BrowserAutomationStudio)

# Installation

```
pip install bas-remote-python
```

# Quick example

Following code will search for _cats_ query in Google and output result into console. You can just copy paste this code and run it.

```python
import asyncio

from bas_remote import BasRemoteClient
from bas_remote import Options


async def main():
    # Set script name, and optionally auth details (login, password).
    options = Options(script_name='TestRemoteControl')

    # Create client.
    script_client = BasRemoteClient(options)

    # Start application, this may take some time.
    await script_client.start()

    # Set parameters for function.
    script_params = {'Query': 'cats'}

    # Run function and wait for result.
    # Following function will return list of strings.
    result = await script_client.run_function(
        'GoogleSearch',  # or 'YourFunctionName'
        script_params)

    # Iterate and output results.
    for link in result:
        print(link)

    await script_client.close()


if __name__ == '__main__':
    asyncio.run(main())
```

Checkout [wiki](https://github.com/CheshireCaat/bas-remote-python/wiki) for more examples.

# Running custom code

Previous example used _TestRemoteControl_ project and _GoogleSearch_ function defined in it.
In most cases you want to use your own projects and functions. In order to do it:

- Install BAS. Download using following [link](https://bablosoft.com/shop/BrowserAutomationStudio#download). **IMPORTANT** You need to be a premium user in order to create project with custom functions.
- Start [record mode](https://i.imgur.com/JrV7ua5.png) and create new function by using [function manager](https://i.imgur.com/yAjLu8v.png). BAS functions works like functions in any other languages. They can be called with parameters and can return value as a result. Functions help to incapsulate and reuse your code.
- Implement it. On following step you need to implement required functionality. Place code into the function that you have created on previous step. They will be called from Python code later. Function parameters will be sent from Python to BAS, while return value will be sent from BAS to Python. Working with BAS is out of scope of this article, check [BAS wiki](https://wiki.bablosoft.com/doku.php) for more info.
- Compile it and give it a name. Check this [article](https://wiki.bablosoft.com/doku.php?id=how_to_protect_your_script) more more instruction for compilation.
- Finally, **allow remote function execution** flag for script must be set. You can do that on following [page](https://bablosoft.com/bas/scripts). See [screenshot](https://i.imgur.com/BrkefIT.png) for more details.

After project with function is prepared, you can use it from Python.
In order to do that, change script and function name in example above.

# How it works

Following diagram will explain project architecture:

![](https://i.imgur.com/9lfF3EJ.png)

**Running custom code** section explains how to prepare your project and upload it into the cloud. Portable BAS instance is downloaded and started automatically, it is also closed automatically when `BasRemoteClient` gets closed. Folder, where portable BAS instance is located by default is _data_ folder relative to executable. It can be customized by using `options.working_dir` setting.

# Project example

You can use _TestRemoteControl_ project in order to test **bas-remote-python** library. It is already uploaded into the cloud and can be used without authentication. List of available functions:

- `Add(X,Y)` - adds two numbers and return their sum.
- `SetProxy(Proxy,IsSocks5)` - sets proxy for current thread. _Proxy_ param is proxy string, _IsSocks5_ is string("true", "false") value indicates if proxy type is socks5. No return value.
- `CheckIp()` - returns remote IP of current thread. Uses ip.bablosoft.com service to test. Can be combined with _SetProxy_ function.
- `GoogleSearch(Query)` - performs Google query, returns result as a list of urls.

Project source code can be downloaded [here](https://drive.google.com/uc?id=1WQYzm-XaZhXUBWQYMM5T-sZ_tdcSfAwS&export=download)

# License

**bas-remote-python** has MIT license.

You can distribute applications using **bas-remote-python** library, including commercial, to user, who don't have BAS premium subscription without any fees.

In order to create project with custom functions you need to have a BAS premium subscription.

In other words, only developers must have BAS premium subscription, not users.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/CheshireCaat/bas-remote-python",
    "name": "bas-remote-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "visual-programming-language, browserautomationstudio, bas-remote-control, bas-remote-client, bot-framework, bas-remote, bas-client, automation, chromium, imacros, windows, desktop, browser, grabber, poster, macros, bas, ide, cef, bot",
    "author": "CheshireCaat",
    "author_email": "cheshirecat902@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/90/c7/f835380a44e56b729c4afde27309b851da84d0864e5419af420066b4e8a5/bas_remote_python-1.6.tar.gz",
    "platform": null,
    "description": "# bas-remote-python\r\n\r\n[![PyPI version](https://badge.fury.io/py/bas-remote-python.svg)](https://badge.fury.io/py/bas-remote-python)\r\n[![GitHub issues](https://img.shields.io/github/issues/CheshireCaat/bas-remote-python)](https://github.com/CheshireCaat/bas-remote-python/issues)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n**bas-remote-python** - Python library, which allows you to **automate Google Chrome browser**.\r\n\r\nIn order to make it possible, BrowserAutomationStudio application is used. **bas-remote-python** allows you to call and control execution of functions created in BAS. Consider following example, you have a BAS function, which executes specified Google search query and returns result as a list of urls. Using this library, you can call that function in any Python application and obtain result. You can distribute applications written with **bas-remote-python** library as well.\r\n\r\n# BrowserAutomationStudio\r\n\r\n**BAS** - is application that allows you to automate any activities in Google Chrome browser with a help of visual programming and without knowing of any programming language. You can think of it as IDE created especially for browser automation:\r\n\r\n![](https://bablosoft.com/landing2/screen-bas.png)\r\n\r\nCheck following link for more info:\r\n\r\n[https://bablosoft.com/shop/BrowserAutomationStudio](https://bablosoft.com/shop/BrowserAutomationStudio)\r\n\r\n# Installation\r\n\r\n```\r\npip install bas-remote-python\r\n```\r\n\r\n# Quick example\r\n\r\nFollowing code will search for _cats_ query in Google and output result into console. You can just copy paste this code and run it.\r\n\r\n```python\r\nimport asyncio\r\n\r\nfrom bas_remote import BasRemoteClient\r\nfrom bas_remote import Options\r\n\r\n\r\nasync def main():\r\n    # Set script name, and optionally auth details (login, password).\r\n    options = Options(script_name='TestRemoteControl')\r\n\r\n    # Create client.\r\n    script_client = BasRemoteClient(options)\r\n\r\n    # Start application, this may take some time.\r\n    await script_client.start()\r\n\r\n    # Set parameters for function.\r\n    script_params = {'Query': 'cats'}\r\n\r\n    # Run function and wait for result.\r\n    # Following function will return list of strings.\r\n    result = await script_client.run_function(\r\n        'GoogleSearch',  # or 'YourFunctionName'\r\n        script_params)\r\n\r\n    # Iterate and output results.\r\n    for link in result:\r\n        print(link)\r\n\r\n    await script_client.close()\r\n\r\n\r\nif __name__ == '__main__':\r\n    asyncio.run(main())\r\n```\r\n\r\nCheckout [wiki](https://github.com/CheshireCaat/bas-remote-python/wiki) for more examples.\r\n\r\n# Running custom code\r\n\r\nPrevious example used _TestRemoteControl_ project and _GoogleSearch_ function defined in it.\r\nIn most cases you want to use your own projects and functions. In order to do it:\r\n\r\n- Install BAS. Download using following [link](https://bablosoft.com/shop/BrowserAutomationStudio#download). **IMPORTANT** You need to be a premium user in order to create project with custom functions.\r\n- Start [record mode](https://i.imgur.com/JrV7ua5.png) and create new function by using [function manager](https://i.imgur.com/yAjLu8v.png). BAS functions works like functions in any other languages. They can be called with parameters and can return value as a result. Functions help to incapsulate and reuse your code.\r\n- Implement it. On following step you need to implement required functionality. Place code into the function that you have created on previous step. They will be called from Python code later. Function parameters will be sent from Python to BAS, while return value will be sent from BAS to Python. Working with BAS is out of scope of this article, check [BAS wiki](https://wiki.bablosoft.com/doku.php) for more info.\r\n- Compile it and give it a name. Check this [article](https://wiki.bablosoft.com/doku.php?id=how_to_protect_your_script) more more instruction for compilation.\r\n- Finally, **allow remote function execution** flag for script must be set. You can do that on following [page](https://bablosoft.com/bas/scripts). See [screenshot](https://i.imgur.com/BrkefIT.png) for more details.\r\n\r\nAfter project with function is prepared, you can use it from Python.\r\nIn order to do that, change script and function name in example above.\r\n\r\n# How it works\r\n\r\nFollowing diagram will explain project architecture:\r\n\r\n![](https://i.imgur.com/9lfF3EJ.png)\r\n\r\n**Running custom code** section explains how to prepare your project and upload it into the cloud. Portable BAS instance is downloaded and started automatically, it is also closed automatically when `BasRemoteClient` gets closed. Folder, where portable BAS instance is located by default is _data_ folder relative to executable. It can be customized by using `options.working_dir` setting.\r\n\r\n# Project example\r\n\r\nYou can use _TestRemoteControl_ project in order to test **bas-remote-python** library. It is already uploaded into the cloud and can be used without authentication. List of available functions:\r\n\r\n- `Add(X,Y)` - adds two numbers and return their sum.\r\n- `SetProxy(Proxy,IsSocks5)` - sets proxy for current thread. _Proxy_ param is proxy string, _IsSocks5_ is string(\"true\", \"false\") value indicates if proxy type is socks5. No return value.\r\n- `CheckIp()` - returns remote IP of current thread. Uses ip.bablosoft.com service to test. Can be combined with _SetProxy_ function.\r\n- `GoogleSearch(Query)` - performs Google query, returns result as a list of urls.\r\n\r\nProject source code can be downloaded [here](https://drive.google.com/uc?id=1WQYzm-XaZhXUBWQYMM5T-sZ_tdcSfAwS&export=download)\r\n\r\n# License\r\n\r\n**bas-remote-python** has MIT license.\r\n\r\nYou can distribute applications using **bas-remote-python** library, including commercial, to user, who don't have BAS premium subscription without any fees.\r\n\r\nIn order to create project with custom functions you need to have a BAS premium subscription.\r\n\r\nIn other words, only developers must have BAS premium subscription, not users.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python library, which allows you to automate Google Chrome browser.",
    "version": "1.6",
    "project_urls": {
        "Documentation": "https://github.com/CheshireCaat/bas-remote-python/wiki",
        "Homepage": "https://github.com/CheshireCaat/bas-remote-python"
    },
    "split_keywords": [
        "visual-programming-language",
        " browserautomationstudio",
        " bas-remote-control",
        " bas-remote-client",
        " bot-framework",
        " bas-remote",
        " bas-client",
        " automation",
        " chromium",
        " imacros",
        " windows",
        " desktop",
        " browser",
        " grabber",
        " poster",
        " macros",
        " bas",
        " ide",
        " cef",
        " bot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa728d263bc6d687b808a00716f40525588a9017d4ac9af2ea3d438e345f92aa",
                "md5": "a4549dc4df1bbf7405a354b77b137b79",
                "sha256": "ea2587be742d3cac9bf97ad1c7fb6400827413d22150c4e89dd0a260f18545f0"
            },
            "downloads": -1,
            "filename": "bas_remote_python-1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a4549dc4df1bbf7405a354b77b137b79",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 19031,
            "upload_time": "2024-08-28T00:09:35",
            "upload_time_iso_8601": "2024-08-28T00:09:35.133985Z",
            "url": "https://files.pythonhosted.org/packages/fa/72/8d263bc6d687b808a00716f40525588a9017d4ac9af2ea3d438e345f92aa/bas_remote_python-1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "90c7f835380a44e56b729c4afde27309b851da84d0864e5419af420066b4e8a5",
                "md5": "bf64c1a4211e0590442cd96cd81b3c56",
                "sha256": "8bd4fe85cd5e60f4781a679c55b2553a8d613e2213e502fbd25bc6ccae1e44e3"
            },
            "downloads": -1,
            "filename": "bas_remote_python-1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "bf64c1a4211e0590442cd96cd81b3c56",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 15363,
            "upload_time": "2024-08-28T00:09:36",
            "upload_time_iso_8601": "2024-08-28T00:09:36.596260Z",
            "url": "https://files.pythonhosted.org/packages/90/c7/f835380a44e56b729c4afde27309b851da84d0864e5419af420066b4e8a5/bas_remote_python-1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-28 00:09:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "CheshireCaat",
    "github_project": "bas-remote-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "bas-remote-python"
}
        
Elapsed time: 1.00123s