Name | pyanty JSON |
Version |
1.0.0
JSON |
| download |
home_page | https://github.com/DedInc/pyanty |
Summary | Python module for controlling Dolphin browser profiles using Selenium, Pyppeteer, and Playwright. Includes Dolphin API for profile management. |
upload_time | 2024-06-08 08:15:36 |
maintainer | None |
docs_url | None |
author | Maehdakvan |
requires_python | >=3.6 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# π¬ pyanty
Python module for controlling Dolphin browser profiles using Selenium, Pyppeteer, and Playwright. Includes Dolphin API for profile management.
## β οΈ Warning!
```
Selenium and some features working only if Dolphin Anty is opened!!! (Local API wrapper must be launched!)
```
## π Quickstart
### Selenium
```python
import random
import pyanty as dolphin
from pyanty import DolphinAPI, STABLE_CHROME_VERSION
api = DolphinAPI(api_key='Your Api Key')
response = api.get_profiles()
if response['data']:
profile_id = response['data'][-1]['id']
if profile_id:
api.delete_profiles([profile_id])
fingerprint = []
while not fingerprint:
fingerprint = api.generate_fingerprint(platform='windows', browser_version=f'{random.randint(114, STABLE_CHROME_VERSION)}')
data = api.fingerprint_to_profile(name='my superprofile', fingerprint=fingerprint)
profile_id = api.create_profile(data)['browserProfileId']
response = dolphin.run_profile(profile_id)
port = response['automation']['port']
driver = dolphin.get_driver(port=port)
driver.get('https://google.com/')
print(driver.title)
driver.quit()
dolphin.close_profile(profile_id)
```
### Pyppeteer
```python
import asyncio
import random
import pyanty as dolphin
from pyanty import DolphinAPI, STABLE_CHROME_VERSION
api = DolphinAPI(api_key='Your Api Key')
response = api.get_profiles()
if response['data']:
profile_id = response['data'][-1]['id']
if profile_id:
api.delete_profiles([profile_id])
fingerprint = []
while not fingerprint:
fingerprint = api.generate_fingerprint(platform='windows', browser_version=f'{random.randint(114, STABLE_CHROME_VERSION)}')
data = api.fingerprint_to_profile(name='my superprofile', fingerprint=fingerprint)
profile_id = api.create_profile(data)['browserProfileId']
response = dolphin.run_profile(profile_id)
port = response['automation']['port']
ws_endpoint = response['automation']['wsEndpoint']
async def main():
browser = await dolphin.get_browser(ws_endpoint, port)
pages = await browser.pages()
page = pages[0]
await page.goto('http://google.com/')
await asyncio.sleep(5)
await browser.disconnect()
asyncio.run(main())
dolphin.close_profile(profile_id)
```
### Pyppeteer
```python
import asyncio
import random
import pyanty as dolphin
from pyanty import DolphinAPI, STABLE_CHROME_VERSION
api = DolphinAPI(api_key='Your Api Key')
response = api.get_profiles()
if response['data']:
profile_id = response['data'][-1]['id']
if profile_id:
api.delete_profiles([profile_id])
fingerprint = []
while not fingerprint:
fingerprint = api.generate_fingerprint(platform='windows', browser_version=f'{random.randint(114, STABLE_CHROME_VERSION)}')
data = api.fingerprint_to_profile(name='my superprofile', fingerprint=fingerprint)
profile_id = api.create_profile(data)['browserProfileId']
response = dolphin.run_profile(profile_id)
port = response['automation']['port']
ws_endpoint = response['automation']['wsEndpoint']
async def main():
browser = await dolphin.get_browser(ws_endpoint, port, core='playwright')
pages = await browser.pages()
page = pages[0]
await page.goto('http://google.com/')
await asyncio.sleep(5)
await browser.disconnect()
asyncio.run(main())
dolphin.close_profile(profile_id)
```
## π Get profiles
```python
from pyanty import DolphinAPI
api = DolphinAPI() # you can enter api_key='Your key' inside instance
```
You can [get an API key here](https://dolphin-anty.com/panel/#/api), but if the token is present in the logs, the module can automatically retrieve it.
```python
response = api.get_profiles()
print(response)
```
### Pagination and limitation
```python
response = api.get_profiles(page=1, limit=300) # default page - 1 limit - 50
```
## π Create profile
```python
fingerprint = api.generate_fingerprint(platform='linux') # you can use platform windows/linux/macos, also you can use screen='1366x768' and browser_version='116' if you need
data = api.fingerprint_to_profile(name='my profile', fingerprint=fingerprint) # also you can add tags=['test', 'pyanty'] and other
response = api.create_profile(data)
print(response)
```
## π Custom data for profile
After this line:
```python
data = api.fingerprint_to_profile(name='my profile', fingerprint=fingerprint)
```
Use for:
### Geolocation πΊοΈ
```python
data.update({'geolocation':{
'mode': 'manual',
'latitude': 33.4,
'longitude': 55.2,
'accuracy': 318
}})
```
### Timezone β°
```python
data.update({'timezone':{
'mode':'manual',
'value':'Pacific/Johnston'
}})
```
### Locale π
```python
data.update({'locale':{
'mode':'manual',
'value':'af_ZA'
}})
```
### Proxy πΈοΈ
```python
data.update({'proxy':{
'name': 'http://37.19.220.129:8443',
'host': '37.19.220.129',
'port': '8443',
'type': 'http'
}})
# also you can add 'login' and 'password' args
```
### and others...
## βοΈ Edit profile
```python
from pyanty import DolphinAPI
api = DolphinAPI()
fingerprint = api.generate_fingerprint(platform='windows')
data = api.fingerprint_to_profile(name='mega profile', fingerprint=fingerprint)
response = api.edit_profile(190438486, data)
print(response)
```
## ποΈ Delete profile(s)
```python
from pyanty import DolphinAPI
api = DolphinAPI()
response = api.delete_profiles([190438486]) # you need specify list ids of profiles
print(response)
```
## 𧩠Using Extensions
### Get extensions
```python
response = api.get_extensions()
print(response)
```
### Pagination and limitation
```python
response = api.get_extensions(page=1, limit=300) # default page - 1 limit - 50
```
## πͺ Load from Chrome Extensions Store
```python
response = api.load_extension_from_url('https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm')
print(response)
```
## π¦ Load from ZIP Archive
```python
response = api.load_extension_from_zip(extension_name='Test', path='path/to/archive.zip')
print(response)
```
## ποΈ Delete extension(s)
```python
response = api.delete_extensions([63654]) # you need specify list ids of profiles
print(response)
```
## π Other features
### Proxy checker
```python
response = api.check_proxy(host='37.19.220.129', port='8443', type='http')
print(response)
# also you can use other kwargs (login='username', password='password')
```
Response:
```json
{"success": true, "country": "US", "region": "Virginia", "city": "Ashburn", "ip": "37.19.220.178", "timezone": "America/New_York"}
```
### MAC Address generator
```python
response = api.generate_mac()
print(response)
```
Response:
```json
{"success": true, "macAddress": "8E:DD:48:08:F1:31"}
```
## Conclusion
pyanty provides a straightforward way to control Dolphin browser profiles for automation testing using Selenium, Pyppeteer or Playwright π€. With the Dolphin API, you can easily create, customize, and manage profiles right from Python. Give it a try for your next web scraping or test automation project! π¬
Raw data
{
"_id": null,
"home_page": "https://github.com/DedInc/pyanty",
"name": "pyanty",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Maehdakvan",
"author_email": "visitanimation@google.com",
"download_url": "https://files.pythonhosted.org/packages/58/90/e318cd9a5aaceb4c73ffdccef623f36446b8a8fba3f6885db3ed3ace4f76/pyanty-1.0.0.tar.gz",
"platform": null,
"description": "# \ud83d\udc2c pyanty\r\n\r\nPython module for controlling Dolphin browser profiles using Selenium, Pyppeteer, and Playwright. Includes Dolphin API for profile management.\r\n\r\n## \u26a0\ufe0f Warning!\r\n\r\n```\r\nSelenium and some features working only if Dolphin Anty is opened!!! (Local API wrapper must be launched!)\r\n```\r\n\r\n## \ud83d\ude80 Quickstart\r\n\r\n### Selenium\r\n\r\n```python\r\nimport random\r\nimport pyanty as dolphin\r\nfrom pyanty import DolphinAPI, STABLE_CHROME_VERSION\r\n\r\napi = DolphinAPI(api_key='Your Api Key')\r\n\r\nresponse = api.get_profiles()\r\nif response['data']:\r\n profile_id = response['data'][-1]['id']\r\n if profile_id:\r\n api.delete_profiles([profile_id])\r\n\r\nfingerprint = []\r\nwhile not fingerprint:\r\n fingerprint = api.generate_fingerprint(platform='windows', browser_version=f'{random.randint(114, STABLE_CHROME_VERSION)}')\r\n\r\ndata = api.fingerprint_to_profile(name='my superprofile', fingerprint=fingerprint)\r\n\r\nprofile_id = api.create_profile(data)['browserProfileId']\r\n\r\nresponse = dolphin.run_profile(profile_id)\r\nport = response['automation']['port']\r\n\r\ndriver = dolphin.get_driver(port=port)\r\ndriver.get('https://google.com/')\r\nprint(driver.title)\r\ndriver.quit()\r\n\r\ndolphin.close_profile(profile_id)\r\n```\r\n\r\n### Pyppeteer\r\n\r\n```python\r\nimport asyncio\r\nimport random\r\nimport pyanty as dolphin\r\nfrom pyanty import DolphinAPI, STABLE_CHROME_VERSION\r\n\r\napi = DolphinAPI(api_key='Your Api Key')\r\n\r\nresponse = api.get_profiles()\r\nif response['data']:\r\n profile_id = response['data'][-1]['id']\r\n if profile_id:\r\n api.delete_profiles([profile_id])\r\n\r\nfingerprint = []\r\nwhile not fingerprint:\r\n fingerprint = api.generate_fingerprint(platform='windows', browser_version=f'{random.randint(114, STABLE_CHROME_VERSION)}')\r\n\r\ndata = api.fingerprint_to_profile(name='my superprofile', fingerprint=fingerprint)\r\n\r\nprofile_id = api.create_profile(data)['browserProfileId']\r\n\r\nresponse = dolphin.run_profile(profile_id)\r\nport = response['automation']['port']\r\nws_endpoint = response['automation']['wsEndpoint']\r\n\r\nasync def main():\r\n browser = await dolphin.get_browser(ws_endpoint, port)\r\n pages = await browser.pages()\r\n page = pages[0]\r\n await page.goto('http://google.com/')\r\n await asyncio.sleep(5)\r\n await browser.disconnect()\r\n\r\nasyncio.run(main())\r\ndolphin.close_profile(profile_id)\r\n```\r\n\r\n### Pyppeteer\r\n\r\n```python\r\nimport asyncio\r\nimport random\r\nimport pyanty as dolphin\r\nfrom pyanty import DolphinAPI, STABLE_CHROME_VERSION\r\n\r\napi = DolphinAPI(api_key='Your Api Key')\r\n\r\nresponse = api.get_profiles()\r\nif response['data']:\r\n profile_id = response['data'][-1]['id']\r\n if profile_id:\r\n api.delete_profiles([profile_id])\r\n\r\nfingerprint = []\r\nwhile not fingerprint:\r\n fingerprint = api.generate_fingerprint(platform='windows', browser_version=f'{random.randint(114, STABLE_CHROME_VERSION)}')\r\n\r\ndata = api.fingerprint_to_profile(name='my superprofile', fingerprint=fingerprint)\r\n\r\nprofile_id = api.create_profile(data)['browserProfileId']\r\n\r\nresponse = dolphin.run_profile(profile_id)\r\nport = response['automation']['port']\r\nws_endpoint = response['automation']['wsEndpoint']\r\n\r\nasync def main():\r\n browser = await dolphin.get_browser(ws_endpoint, port, core='playwright')\r\n pages = await browser.pages()\r\n page = pages[0]\r\n await page.goto('http://google.com/')\r\n await asyncio.sleep(5)\r\n await browser.disconnect()\r\n\r\nasyncio.run(main())\r\ndolphin.close_profile(profile_id)\r\n```\r\n\r\n## \ud83d\udcdd Get profiles\r\n\r\n```python\r\nfrom pyanty import DolphinAPI\r\n\r\napi = DolphinAPI() # you can enter api_key='Your key' inside instance\r\n```\r\n\r\nYou can [get an API key here](https://dolphin-anty.com/panel/#/api), but if the token is present in the logs, the module can automatically retrieve it.\r\n\r\n```python\r\nresponse = api.get_profiles() \r\n\r\nprint(response)\r\n```\r\n\r\n### Pagination and limitation\r\n\r\n```python\r\nresponse = api.get_profiles(page=1, limit=300) # default page - 1 limit - 50\r\n```\r\n\r\n## \ud83c\udd95 Create profile\r\n\r\n```python\r\nfingerprint = api.generate_fingerprint(platform='linux') # you can use platform windows/linux/macos, also you can use screen='1366x768' and browser_version='116' if you need\r\n\r\ndata = api.fingerprint_to_profile(name='my profile', fingerprint=fingerprint) # also you can add tags=['test', 'pyanty'] and other\r\n\r\nresponse = api.create_profile(data) \r\n\r\nprint(response)\r\n```\r\n\r\n## \ud83d\udcdd Custom data for profile\r\n\r\nAfter this line:\r\n\r\n```python\r\ndata = api.fingerprint_to_profile(name='my profile', fingerprint=fingerprint)\r\n```\r\n\r\nUse for:\r\n\r\n### Geolocation \ud83d\uddfa\ufe0f\r\n\r\n```python\r\ndata.update({'geolocation':{\r\n 'mode': 'manual',\r\n 'latitude': 33.4,\r\n 'longitude': 55.2,\r\n 'accuracy': 318\r\n}})\r\n```\r\n\r\n### Timezone \u23f0\r\n\r\n```python\r\ndata.update({'timezone':{\r\n 'mode':'manual',\r\n 'value':'Pacific/Johnston'\r\n}})\r\n```\r\n\r\n### Locale \ud83c\udf0e\r\n\r\n```python\r\ndata.update({'locale':{\r\n 'mode':'manual',\r\n 'value':'af_ZA' \r\n}})\r\n```\r\n\r\n### Proxy \ud83d\udd78\ufe0f\r\n\r\n```python\r\ndata.update({'proxy':{\r\n 'name': 'http://37.19.220.129:8443',\r\n 'host': '37.19.220.129',\r\n 'port': '8443',\r\n 'type': 'http' \r\n}})\r\n# also you can add 'login' and 'password' args\r\n```\r\n\r\n### and others...\r\n\r\n## \u270f\ufe0f Edit profile\r\n\r\n```python \r\nfrom pyanty import DolphinAPI\r\n\r\napi = DolphinAPI()\r\n\r\nfingerprint = api.generate_fingerprint(platform='windows') \r\n\r\ndata = api.fingerprint_to_profile(name='mega profile', fingerprint=fingerprint)\r\n\r\nresponse = api.edit_profile(190438486, data)\r\n\r\nprint(response)\r\n```\r\n\r\n## \ud83d\uddd1\ufe0f Delete profile(s)\r\n\r\n```python\r\nfrom pyanty import DolphinAPI\r\n\r\napi = DolphinAPI()\r\n\r\nresponse = api.delete_profiles([190438486]) # you need specify list ids of profiles \r\n\r\nprint(response)\r\n```\r\n\r\n## \ud83e\udde9 Using Extensions\r\n\r\n### Get extensions\r\n\r\n```python\r\nresponse = api.get_extensions() \r\n\r\nprint(response)\r\n```\r\n\r\n### Pagination and limitation\r\n\r\n```python\r\nresponse = api.get_extensions(page=1, limit=300) # default page - 1 limit - 50\r\n```\r\n\r\n## \ud83c\udfea Load from Chrome Extensions Store\r\n\r\n```python\r\nresponse = api.load_extension_from_url('https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm')\r\n\r\nprint(response)\r\n```\r\n\r\n## \ud83d\udce6 Load from ZIP Archive\r\n\r\n```python\r\nresponse = api.load_extension_from_zip(extension_name='Test', path='path/to/archive.zip')\r\n\r\nprint(response)\r\n```\r\n\r\n## \ud83d\uddd1\ufe0f Delete extension(s)\r\n\r\n```python\r\nresponse = api.delete_extensions([63654]) # you need specify list ids of profiles \r\n\r\nprint(response)\r\n```\r\n\r\n## \ud83d\udd0d Other features\r\n\r\n### Proxy checker\r\n\r\n```python\r\nresponse = api.check_proxy(host='37.19.220.129', port='8443', type='http')\r\n\r\nprint(response)\r\n\r\n# also you can use other kwargs (login='username', password='password')\r\n```\r\n\r\nResponse:\r\n\r\n```json\r\n{\"success\": true, \"country\": \"US\", \"region\": \"Virginia\", \"city\": \"Ashburn\", \"ip\": \"37.19.220.178\", \"timezone\": \"America/New_York\"}\r\n```\r\n\r\n### MAC Address generator\r\n\r\n```python\r\nresponse = api.generate_mac() \r\n\r\nprint(response) \r\n```\r\n\r\nResponse:\r\n\r\n```json\r\n{\"success\": true, \"macAddress\": \"8E:DD:48:08:F1:31\"}\r\n```\r\n\r\n## Conclusion\r\n\r\npyanty provides a straightforward way to control Dolphin browser profiles for automation testing using Selenium, Pyppeteer or Playwright \ud83e\udd16. With the Dolphin API, you can easily create, customize, and manage profiles right from Python. Give it a try for your next web scraping or test automation project! \ud83d\udc2c\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Python module for controlling Dolphin browser profiles using Selenium, Pyppeteer, and Playwright. Includes Dolphin API for profile management.",
"version": "1.0.0",
"project_urls": {
"Bug Tracker": "https://github.com/DedInc/pyanty/issues",
"Homepage": "https://github.com/DedInc/pyanty"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5690f94769fd9569525d5dd194906263c65ae42c8ccddaa67c00bdd4733c68e2",
"md5": "293467eaaaccbf3c1b58cb9f32fa7463",
"sha256": "266323fef29386b84b4f70b61936d4cc6600010e53ff641e3fc78e1b2f38f2f9"
},
"downloads": -1,
"filename": "pyanty-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "293467eaaaccbf3c1b58cb9f32fa7463",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 9749,
"upload_time": "2024-06-08T08:15:34",
"upload_time_iso_8601": "2024-06-08T08:15:34.526540Z",
"url": "https://files.pythonhosted.org/packages/56/90/f94769fd9569525d5dd194906263c65ae42c8ccddaa67c00bdd4733c68e2/pyanty-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5890e318cd9a5aaceb4c73ffdccef623f36446b8a8fba3f6885db3ed3ace4f76",
"md5": "ae3c1210c24adaaa2d553d78c04cc3fb",
"sha256": "81db75acd512066ac94eff8dac209097392a261cdcc1f70238d9e2dee6c4e77a"
},
"downloads": -1,
"filename": "pyanty-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "ae3c1210c24adaaa2d553d78c04cc3fb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 10840,
"upload_time": "2024-06-08T08:15:36",
"upload_time_iso_8601": "2024-06-08T08:15:36.689260Z",
"url": "https://files.pythonhosted.org/packages/58/90/e318cd9a5aaceb4c73ffdccef623f36446b8a8fba3f6885db3ed3ace4f76/pyanty-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-08 08:15:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DedInc",
"github_project": "pyanty",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyanty"
}