Skip to main content

Python module for controlling Dolphin browser profiles using Selenium, Pyppeteer, and Playwright. Includes Dolphin API for profile management.

Project description

🐬 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

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

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)

Playwright/Patchright

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') # or core='patchright' for using undetectable version
    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

from pyanty import DolphinAPI

api = DolphinAPI() # you can enter api_key='Your key' inside instance

You can get an API key here, but if the token is present in the logs, the module can automatically retrieve it.

response = api.get_profiles() 

print(response)

Pagination and limitation

response = api.get_profiles(page=1, limit=300) # default page - 1 limit - 50

🆕 Create profile

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:

data = api.fingerprint_to_profile(name='my profile', fingerprint=fingerprint)

Use for:

Geolocation 🗺️

data.update({'geolocation':{
  'mode': 'manual',
  'latitude': 33.4,
  'longitude': 55.2,
  'accuracy': 318
}})

Timezone ⏰

data.update({'timezone':{
  'mode':'manual',
  'value':'Pacific/Johnston'
}})

Locale 🌎

data.update({'locale':{
  'mode':'manual',
  'value':'af_ZA' 
}})

Proxy 🕸️

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

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)

from pyanty import DolphinAPI

api = DolphinAPI()

response = api.delete_profiles([190438486]) # you need specify list ids of profiles  

print(response)

🧩 Using Extensions

Get extensions

response = api.get_extensions() 

print(response)

Pagination and limitation

response = api.get_extensions(page=1, limit=300) # default page - 1 limit - 50

🏪 Load from Chrome Extensions Store

response = api.load_extension_from_url('https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm')

print(response)

📦 Load from ZIP Archive

response = api.load_extension_from_zip(extension_name='Test', path='path/to/archive.zip')

print(response)

🗑️ Delete extension(s)

response = api.delete_extensions([63654]) # you need specify list ids of profiles  

print(response)

🔍 Other features

Proxy checker

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:

{"success": true, "country": "US", "region": "Virginia", "city": "Ashburn", "ip": "37.19.220.178", "timezone": "America/New_York"}

MAC Address generator

response = api.generate_mac()  

print(response) 

Response:

{"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! 🐬

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyanty-1.0.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyanty-1.0.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file pyanty-1.0.1.tar.gz.

File metadata

  • Download URL: pyanty-1.0.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyanty-1.0.1.tar.gz
Algorithm Hash digest
SHA256 537a6b671a80830c2fa53a4c8cd0d042b9bd13bebfa1d8bac24cca40a7d8fb43
MD5 734f566365debaf257910e365c87046c
BLAKE2b-256 48434a3ce22eb51f4b164c663933079e1a4f95886335c6421d625c850dd24fc0

See more details on using hashes here.

File details

Details for the file pyanty-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyanty-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyanty-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6663ecdf9179820833659905f81c0eddd3076e7db95d1a36f53d1317f31a4666
MD5 9110fc8ab309b146b4abc933c911069d
BLAKE2b-256 43bf03181380a075377b0a2a3149879bb44c124162dd795304e584ff6748e3ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page