# browserstack-local-python
[![Build Status](https://travis-ci.org/browserstack/browserstack-local-python.svg?branch=master)](https://travis-ci.org/browserstack/browserstack-local-python)
Python bindings for BrowserStack Local.
## Installation
```sh
pip install browserstack-local
```
## Example
```python
from browserstack.local import Local
#creates an instance of Local
bs_local = Local()
#replace <browserstack-accesskey> with your key. You can also set an environment variable - "BROWSERSTACK_ACCESS_KEY".
bs_local_args = { "key": "<browserstack-accesskey>" }
#starts the Local instance with the required arguments
bs_local.start(**bs_local_args)
#check if BrowserStack local instance is running
print(bs_local.isRunning())
#stop the Local instance
bs_local.stop()
```
## Arguments
Apart from the key, all other BrowserStack Local modifiers are optional. For the full list of modifiers, refer [BrowserStack Local modifiers](https://www.browserstack.com/local-testing#modifiers). For examples, refer below -
#### Verbose Logging
To enable verbose logging -
```sh
bs_local_args = { "key": "<browserstack-accesskey>" , "v": "true"}
```
#### Folder Testing
To test local folder rather internal server, provide path to folder as value of this option -
```sh
bs_local_args = { "key": "<browserstack-accesskey>" , "f": "/my/awesome/folder"}
```
#### Force Start
To kill other running Browserstack Local instances -
```sh
bs_local_args = { "key": "<browserstack-accesskey>" , "force": "true"}
```
#### Only Automate
To disable local testing for Live and Screenshots, and enable only Automate -
```sh
bs_local_args = { "key": "<browserstack-accesskey>" , "onlyAutomate": "true"}
```
#### Force Local
To route all traffic via local(your) machine -
```sh
bs_local_args = { "key": "<browserstack-accesskey>" , "forcelocal": "true"}
```
#### Proxy
To use a proxy for local testing -
* proxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
* proxyPort: Port for the proxy, defaults to 3128 when -proxyHost is used
* proxyUser: Username for connecting to proxy (Basic Auth Only)
* proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified
```sh
bs_local_args = { "key": "<browserstack-accesskey>", "proxyHost": "127.0.0.1", "proxyPort": "8000", "proxyUser": "user", "proxyPass": "password"}
```
#### Local Proxy
To use local proxy in local testing -
* localProxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
* localProxyPort: Port for the proxy, defaults to 8081 when -localProxyHost is used
* localProxyUser: Username for connecting to proxy (Basic Auth Only)
* localProxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified
```
bs_local_args = { "key": "<browserstack-accesskey>", "localProxyHost": "127.0.0.1", "localProxyPort": "8000", "-localProxyUser": "user", "-localProxyPass": "password"}
```
#### PAC (Proxy Auto-Configuration)
To use PAC (Proxy Auto-Configuration) in local testing -
* pac-file: PAC (Proxy Auto-Configuration) file’s absolute path
```
bs_local_args = { "key": "<browserstack-accesskey>" , "-pac-file": "<pac_file_abs_path>"}
```
#### Local Identifier
If doing simultaneous multiple local testing connections, set this uniquely for different processes -
```sh
bs_local_args = { "key": "<browserstack-accesskey>" , "localIdentifier": "randomstring"}
```
## Additional Arguments
#### Binary Path
By default, BrowserStack local wrappers try downloading and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument.
Path to specify local Binary path -
```sh
bs_local_args = { "key": "<browserstack-accesskey>" , "binarypath": "/browserstack/BrowserStackLocal"}
```
#### Logfile
To save the logs to the file while running with the '-v' argument, you can specify the path of the file. By default the logs are saved in the local.log file in the present woring directory.
To specify the path to file where the logs will be saved -
```sh
bs_local_args = { "key": "<browserstack-accesskey>" , "v": "true", "logfile": "/browserstack/logs.txt"}
```
## Contribute
To run the test suite run, `python -m unittest discover`.
### Reporting bugs
You can submit bug reports either in the Github issue tracker.
Before submitting an issue please check if there is already an existing issue. If there is, please add any additional information give it a "+1" in the comments.
When submitting an issue please describe the issue clearly, including how to reproduce the bug, which situations it appears in, what you expect to happen, what actually happens, and what platform (operating system and version) you are using.
### Pull Requests
We love pull requests! We are very happy to work with you to get your changes merged in, however, please keep the following in mind.
* Adhere to the coding conventions you see in the surrounding code.
* Include tests, and make sure all tests pass.
* Before submitting a pull-request, clean up the git history by going over your commits and squashing together minor changes and fixes into the corresponding commits. You can do this using the interactive rebase command.
Raw data
{
"_id": null,
"home_page": "https://github.com/browserstack/browserstack-local-python",
"name": "browserstack-local",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "BrowserStack, Local, selenium, testing",
"author": "BrowserStack",
"author_email": "support@browserstack.com",
"download_url": "https://files.pythonhosted.org/packages/72/ba/4f80c54ae612d8d4d96f9cdec6a2ae37b4552740f419b38c5a9b0bdf0b69/browserstack-local-1.2.9.tar.gz",
"platform": null,
"description": "# browserstack-local-python\n\n[![Build Status](https://travis-ci.org/browserstack/browserstack-local-python.svg?branch=master)](https://travis-ci.org/browserstack/browserstack-local-python)\n\nPython bindings for BrowserStack Local.\n\n## Installation\n\n```sh\npip install browserstack-local\n```\n\n## Example\n\n```python\nfrom browserstack.local import Local\n\n#creates an instance of Local\nbs_local = Local()\n\n#replace <browserstack-accesskey> with your key. You can also set an environment variable - \"BROWSERSTACK_ACCESS_KEY\".\nbs_local_args = { \"key\": \"<browserstack-accesskey>\" }\n\n#starts the Local instance with the required arguments\nbs_local.start(**bs_local_args)\n\n#check if BrowserStack local instance is running\nprint(bs_local.isRunning())\n\n#stop the Local instance\nbs_local.stop()\n\n```\n\n## Arguments\n\nApart from the key, all other BrowserStack Local modifiers are optional. For the full list of modifiers, refer [BrowserStack Local modifiers](https://www.browserstack.com/local-testing#modifiers). For examples, refer below - \n\n#### Verbose Logging\nTo enable verbose logging - \n```sh\nbs_local_args = { \"key\": \"<browserstack-accesskey>\" , \"v\": \"true\"}\n```\n\n#### Folder Testing\nTo test local folder rather internal server, provide path to folder as value of this option - \n```sh\nbs_local_args = { \"key\": \"<browserstack-accesskey>\" , \"f\": \"/my/awesome/folder\"}\n```\n\n#### Force Start \nTo kill other running Browserstack Local instances - \n```sh\nbs_local_args = { \"key\": \"<browserstack-accesskey>\" , \"force\": \"true\"}\n```\n\n#### Only Automate\nTo disable local testing for Live and Screenshots, and enable only Automate - \n```sh\nbs_local_args = { \"key\": \"<browserstack-accesskey>\" , \"onlyAutomate\": \"true\"}\n```\n\n#### Force Local\nTo route all traffic via local(your) machine - \n```sh\nbs_local_args = { \"key\": \"<browserstack-accesskey>\" , \"forcelocal\": \"true\"}\n```\n\n#### Proxy\nTo use a proxy for local testing - \n\n* proxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent\n* proxyPort: Port for the proxy, defaults to 3128 when -proxyHost is used\n* proxyUser: Username for connecting to proxy (Basic Auth Only)\n* proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified\n\n```sh\nbs_local_args = { \"key\": \"<browserstack-accesskey>\", \"proxyHost\": \"127.0.0.1\", \"proxyPort\": \"8000\", \"proxyUser\": \"user\", \"proxyPass\": \"password\"}\n```\n\n#### Local Proxy\nTo use local proxy in local testing -\n\n* localProxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent\n* localProxyPort: Port for the proxy, defaults to 8081 when -localProxyHost is used\n* localProxyUser: Username for connecting to proxy (Basic Auth Only)\n* localProxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified\n\n```\nbs_local_args = { \"key\": \"<browserstack-accesskey>\", \"localProxyHost\": \"127.0.0.1\", \"localProxyPort\": \"8000\", \"-localProxyUser\": \"user\", \"-localProxyPass\": \"password\"}\n```\n\n#### PAC (Proxy Auto-Configuration)\nTo use PAC (Proxy Auto-Configuration) in local testing -\n\n* pac-file: PAC (Proxy Auto-Configuration) file\u2019s absolute path\n\n```\nbs_local_args = { \"key\": \"<browserstack-accesskey>\" , \"-pac-file\": \"<pac_file_abs_path>\"}\n```\n\n#### Local Identifier\nIf doing simultaneous multiple local testing connections, set this uniquely for different processes - \n```sh\nbs_local_args = { \"key\": \"<browserstack-accesskey>\" , \"localIdentifier\": \"randomstring\"}\n```\n\n## Additional Arguments\n\n#### Binary Path\n\nBy default, BrowserStack local wrappers try downloading and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument.\nPath to specify local Binary path -\n```sh\nbs_local_args = { \"key\": \"<browserstack-accesskey>\" , \"binarypath\": \"/browserstack/BrowserStackLocal\"}\n```\n\n#### Logfile\nTo save the logs to the file while running with the '-v' argument, you can specify the path of the file. By default the logs are saved in the local.log file in the present woring directory. \nTo specify the path to file where the logs will be saved - \n```sh\nbs_local_args = { \"key\": \"<browserstack-accesskey>\" , \"v\": \"true\", \"logfile\": \"/browserstack/logs.txt\"}\n```\n\n## Contribute\n\nTo run the test suite run, `python -m unittest discover`.\n\n### Reporting bugs\n\nYou can submit bug reports either in the Github issue tracker.\n\nBefore submitting an issue please check if there is already an existing issue. If there is, please add any additional information give it a \"+1\" in the comments.\n\nWhen submitting an issue please describe the issue clearly, including how to reproduce the bug, which situations it appears in, what you expect to happen, what actually happens, and what platform (operating system and version) you are using.\n\n### Pull Requests\n\nWe love pull requests! We are very happy to work with you to get your changes merged in, however, please keep the following in mind.\n\n* Adhere to the coding conventions you see in the surrounding code.\n* Include tests, and make sure all tests pass.\n* Before submitting a pull-request, clean up the git history by going over your commits and squashing together minor changes and fixes into the corresponding commits. You can do this using the interactive rebase command.\n",
"bugtrack_url": null,
"license": null,
"summary": "Python bindings for Browserstack Local",
"version": "1.2.9",
"project_urls": {
"Download": "https://github.com/browserstack/browserstack-local-python/archive/master.zip",
"Homepage": "https://github.com/browserstack/browserstack-local-python"
},
"split_keywords": [
"browserstack",
" local",
" selenium",
" testing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0dfa7d2c1e1e3afc7691a9caafc3739d10833df77a24095d11af501e8173291a",
"md5": "9959983f4e786885e8745d083df7519f",
"sha256": "912c3ad7c8ed9e441f89a1119e1130874a1c2ec4da6cb8f8dfe7853af9e42955"
},
"downloads": -1,
"filename": "browserstack_local-1.2.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9959983f4e786885e8745d083df7519f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7272,
"upload_time": "2024-10-24T12:01:54",
"upload_time_iso_8601": "2024-10-24T12:01:54.371523Z",
"url": "https://files.pythonhosted.org/packages/0d/fa/7d2c1e1e3afc7691a9caafc3739d10833df77a24095d11af501e8173291a/browserstack_local-1.2.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "72ba4f80c54ae612d8d4d96f9cdec6a2ae37b4552740f419b38c5a9b0bdf0b69",
"md5": "0139a415cc3ea33131f9f342289de515",
"sha256": "3323eb8a71ff821d0fada2d5328e738f8f2e5e41edec595e1788d7812528f2af"
},
"downloads": -1,
"filename": "browserstack-local-1.2.9.tar.gz",
"has_sig": false,
"md5_digest": "0139a415cc3ea33131f9f342289de515",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7543,
"upload_time": "2024-10-24T12:01:55",
"upload_time_iso_8601": "2024-10-24T12:01:55.371064Z",
"url": "https://files.pythonhosted.org/packages/72/ba/4f80c54ae612d8d4d96f9cdec6a2ae37b4552740f419b38c5a9b0bdf0b69/browserstack-local-1.2.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-24 12:01:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "browserstack",
"github_project": "browserstack-local-python",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"lcname": "browserstack-local"
}