Skip to main content

Persistent profiles

This tutorial will show you how to work with Surfsky cloud browser persistent profiles.

Create persistent profile

In order to create persistent profile you have to provide it's title and target operating system (win or mac). It is optional to provide proxy or open vpn config, but if not provided you have to define it on every start. Checkout api docs for more info.

import os

import httpx

API_TOKEN = os.environ['API_TOKEN']
PROXY = os.environ['PROXY']


async def create_persistent_profile():
async with httpx.AsyncClient(
base_url='https://api-public.surfsky.io',
headers={'X-Cloud-Api-Token': API_TOKEN},
timeout=60.0,
) as client:
create_profile_resp = await client.post(
'/profiles',
json={
'title': 'Test profile',
'fingerprint': {'os': 'win'},
'proxy': PROXY,
},
)
create_profile_resp.raise_for_status()

return {'uuid': create_profile_resp.json()['data']['uuid']}

Start persistent profile

To start persistent profile you have to make POST request to profile specific url. In case proxy or vpn config was provided on creation you don't have to specify it on start, otherwise proxy or open vpn config is required. Checkout api docs for more info.

import os

import httpx

API_TOKEN = os.environ['API_TOKEN']
PROFILE_UUID = os.environ['PROFILE_UUID']


async def start_persistent_profile():
async with httpx.AsyncClient(
base_url='https://api-public.surfsky.io',
headers={'X-Cloud-Api-Token': API_TOKEN},
timeout=60.0,
) as client:
browser_data_resp = await client.post(f'/profiles/{PROFILE_UUID}/start')
browser_data_resp.raise_for_status()

return browser_data_resp.json()