• Website
  • Server status
  • API documentation
  • Blog
Telegram Icon Community
EN
English
Português
Русский
中文 (中国)
Tiếng Việt
Log in Try for €1.99
  • Website
  • Server status
  • API documentation
  • Blog
  • Telegram Icon Community
  • English (US)
    English
    Português
    Русский
    中文 (中国)
    Tiếng Việt
Log in View Plans

Custom Python scripts

Build powerful automation workflows with Python and the Multilogin API. Create, manage, and launch browser profiles with fully customizable scripts.

search icon

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Getting started with Multilogin X automation
  • Basic automation with CLI
  • Low-code automation with Postman
  • Script runner & predefined scripts
  • Puppeteer, Selenium, and Playwright
  • Custom Python scripts
  • Quick solutions with Developer Tools
  • Home
  • breadcrumb separator bar
  • Multilogin X
  • breadcrumb separator bar
  • Task automation with API
  • breadcrumb separator bar
  • Custom Python scripts
  • breadcrumb separator bar
  • How to launch CookieRobot using Python

How to launch CookieRobot using Python

Written by Marcelo B ( Updated on May 14th, 2025 )

Updated on May 14th, 2025

CookieRobot makes your profiles look more legit by automatically collecting cookies from your chosen websites – no manual crawling needed! In this guide, we’ll walk you through how to use it to streamline the process.

Already familiar with automation or completed some steps? Use the table of contents on the right to jump straight to what you need. Let’s go!

Python code application

In this example, settings are configured in the payload object, inside the run_script() function:

  • CookieRobot will be running through the file cookie_robot.py
  • The profile IDs worked are set to ced16576-a67b-4ae5-8459-c07991d50f27 and ec0cf95f-b199-4b1c-b394-af1e01ac9c09
  • Both profiles will run in non-headless mode
  • The websites are Yahoo.com and Amazon.com, and they will be visited in a random order
  • Since fractionMode is set to 1, 100% of the websites listed will be visited
  • CookieRobot will automatically accept cookie consent notices if they appear 
import logging
import requests
import json

# In project root you need a file called token with your auth token in there
def setup_logging():
    """Set up logging configuration."""
    logging.basicConfig(
        level=logging.INFO,
        format="%(asctime)s - %(levelname)s - %(message)s",
        handlers=[
            logging.FileHandler("script_runner.log"),
            logging.StreamHandler()
        ]
    )

def get_token_from_file():
    """Read the token from a file called 'token' in the project root."""
    try:
        with open("token", "r") as file:
            token = file.read().strip()
            return token
    except FileNotFoundError:
        logging.error("Token file not found in the project root.")
        raise
    except Exception as e:
        logging.error("An error occurred while reading the token file: %s", str(e))
        raise

def run_script():
    url = "https://launcher.mlx.yt:45001/api/v1/run_script"
    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {get_token_from_file()}"
    }

    payload = {
        "script_file": "cookie_robot.py",
        "profile_ids": [
            {
                "profile_id": "ced16576-a67b-4ae5-8459-c07991d50f27",
                "is_headless": False
            },
            # {
            #     "profile_id": "ec0cf95f-b199-4b1c-b394-af1e01ac9c09",
            #     "is_headless": False
            # },

        ],
        "script_params": [
        {
            "name": "websites",
            "value": ["yahoo.com", "amazon.com"]
        },
        {
            "name": "randomOrder",
            "value": True
        },
        {
            "name": "fractionMode",
            "value": 1
        },
        {
            "name": "processCookieConsent",
            "value": True
        }
    ]
    }
    try:
        logging.info("Payload to send: %s", json.dumps(payload, indent=4))
        logging.info("Sending request to the script runner endpoint...")
        response = requests.post(url, headers=headers, data=json.dumps(payload), timeout=30)

        if response.status_code == 200:
            logging.info("Script executed successfully.")
            logging.info("Response: %s", response.json())
        else:
            logging.error("Failed to execute script. Status code: %d", response.status_code)
            logging.error("Response: %s", response.text)
    except requests.exceptions.RequestException as e:
        logging.error("An error occurred while making the request: %s", str(e))

if __name__ == "__main__":
    setup_logging()
    run_script()

Was this article helpful?

Give feedback about this article

In this article

  • Python code application

Multilogin community

Stay informed, share your thoughts, and engage with others!

Telegram Icon Join us on Telegram

Read more on the topic

Blog Post Img

10 Best Datacenter Proxies for Web Scraping (2025 Edition)

Apr 2, 2025 5 min read
Google SERP Img

What is a Google SERP Proxy and Why Should You Care?

Apr 1, 2025 6 min read
UK Proxy Img

What Are Dedicated UK Proxies? Everything You Need to Know

Apr 1, 2025 6 min read
Related Article Title Icon

Related Articles

  • How to launch CookieRobot using Script runner in Postman
  • How to use CookieRobot in Multilogin 6
  • How to run CookieRobot in Multilogin CLI

ANTIDETECT PLATFORM

  • Antidetect browser
  • Mobile antidetect browser
  • Headless browser
  • Multilogin residential proxies
  • Multi-account management
  • Web automation

RESOURCES

  • Knowledge base
  • API documentation
  • Glossary
  • Blog
  • Multilogin 6 download
  • Server status
  • Release notes

PLATFORM PROXIES

  • Google proxy
  • Facebook proxy
  • Reddit proxy
  • Twitter proxy
  • Amazon proxy
  • LinkedIn proxy

GEO PROXIES

  • Japan proxy
  • UK proxy
  • USA proxy
  • China proxy
  • Canada proxy
  • India proxy

MULTI-ACCOUNT MANAGEMENT

  • Create multiple Facebook accounts
  • Create multiple LinkedIn accounts
  • Create multiple Amazon accounts
  • Create multiple eBay accounts
  • Create multiple Gmail accounts
  • Create multiple Discord accounts

COMPARISON

  • Multilogin vs. Gologin
  • Multilogin vs. Adspower
  • Multilogin vs. Dolphin Anty
  • Multilogin vs. Incognition
  • Multilogin vs. Octo Browser

GET IN TOUCH

  • Contact 24/7 support
    [email protected]
  • Contact sales
  • Affiliate program
  • Careers

© 2025 Multilogin. All rights reserved.

  • Privacy policy
  • Terms of service
  • Cookie policy
Multilogin abstract watermark
  • ANTIDETECT PLATFORM

    • Antidetect browser
    • Mobile antidetect browser
    • Headless browser
    • Multilogin residential proxies
    • Multi-account management
    • Web automation
  • RESOURCES

    • Knowledge base
    • API documentation
    • Glossary
    • Blog
    • Multilogin 6 download
    • Server status
    • Release notes
  • MULTI-ACCOUNT MANAGEMENT

    • Create multiple Facebook accounts
    • Create multiple LinkedIn accounts
    • Create multiple Amazon accounts
    • Create multiple eBay accounts
    • Create multiple Gmail accounts
    • Create multiple Discord accounts
  • COMPARISON

    • Multilogin vs. Gologin
    • Multilogin vs. Adspower
    • Multilogin vs. Dolphin Anty
    • Multilogin vs. Incognition
    • Multilogin vs. Octo Browser
  • PLATFORM PROXIES

    • Google proxy
    • Facebook proxy
    • Reddit proxy
    • Twitter proxy
    • Amazon proxy
    • LinkedIn proxy
  • GEO PROXIES

    • Japan proxy
    • UK proxy
    • USA proxy
    • China proxy
    • Canada proxy
    • India proxy
  • GET IN TOUCH

    • 24/7 support: [email protected]
    • Contact sales
    • Affiliate program
    • Careers
Multilogin abstract watermark
  • Privacy policy
  • Terms of service
  • Cookie policy

© 2025 Multilogin. All rights reserved.

Expand