TakionAPI
Start a TrialJoin our DiscordBuy a PlanDashboard
  • Takion API
  • Interacting with our APIs
  • Datadome
    • Bypass Solution
    • Example Implementations
    • Common Errors & Troubleshooting
  • Incapsula / Imperva
    • reese84 Bypass Solution
    • ___utmvc Bypass Solution
    • Example Implementations
    • Common Errors & Troubleshooting
  • Perimeter X Mobile
    • Bypass Solution
    • Example Implementations
  • GeeTest
    • v3 Bypass Solution
    • v4 Bypass Solution
    • Example Implementations
  • AWS Cognito
    • Bypass Solution
    • Example Implementations
  • Castle
    • Bypass Solution
    • Example Implementations
  • NuData
    • Bypass Solution
    • Example Implementations
  • Image-to-Text Captchas / OCR
    • Bypass Solution
    • Example Implementations
  • Frameworks & Modules
    • Adyen and riskData
    • Queue-IT Module
Powered by GitBook
On this page

Was this helpful?

  1. Incapsula / Imperva

Example Implementations

from requests import post
from tls_client import Session

API_KEY = "TAKION_API_XXX" # Fill it with your api key

if __name__ == "__main__":
    session = Session(client_identifier="chrome_111")
    response = session.get("https://www.ticketmaster.es/epsf/eps-d", headers={
        "accept": "application/json; charset=utf-8",
        "accept-language": "en-GB,en;q=0.9",
        "content-type": "text/plain; charset=utf-8",
        "origin": "null",
        "priority": "u=1, i",
        "sec-ch-ua": '"Chromium";v="125", "Google Chrome";v="125", "Not-A.Brand";v="99"',
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"macOS\"",
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "cross-site",
        "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
    })

    challenge_payload = post(
        "https://incapsula.takionapi.tech/reese84", 
        json={
            "script": response.text
        },
        headers={
            "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
            "x-api-key": API_KEY
        }
    ).json()['payload']

    response = session.post(
        "https://epsf.ticketmaster.es/eps-d", 
        headers={
            "accept": "application/json; charset=utf-8",
            "accept-language": "en-GB,en;q=0.9",
            "content-type": "text/plain; charset=utf-8",
            "origin": "null",
            "priority": "u=1, i",
            "sec-ch-ua": '"Chromium";v="125", "Google Chrome";v="125", "Not-A.Brand";v="99"',
            "sec-ch-ua-mobile": "?0",
            "sec-ch-ua-platform": "\"macOS\"",
            "sec-fetch-dest": "empty",
            "sec-fetch-mode": "cors",
            "sec-fetch-site": "cross-site",
            "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
        }, 
        data=challenge_payload,
        params={"d":"www.ticketmaster.es"}
    )
    response = response.json()
    
    # Set cookie
    session.cookies.set("reese84", response['token'])

    headers = {
        'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
        'accept-language': 'en-GB,en;q=0.9',
        'cache-control': 'max-age=0',
        'priority': 'u=0, i',
        'referer': 'https://availability.ticketmaster.es/api/v2/TM_NL/availability/299807?subChannelId=1',
        'sec-ch-ua': '"Chromium";v="125", "Google Chrome";v="125", "Not-A.Brand";v="99"',
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-platform': '"macOS"',
        'sec-fetch-dest': 'document',
        'sec-fetch-mode': 'navigate',
        'sec-fetch-site': 'same-origin',
        'upgrade-insecure-requests': '1',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36',
    }
    params = (
        ('subChannelId', '1'),
    )

    response = session.get('https://availability.ticketmaster.es/api/v2/TM_ES/availability/39185', headers=headers, params=params)
    print(response.text)
from requests import Session, post
from re import search

def is_challenge(response):
    pattern = r'src="(/_Incapsula_Resource\?[^"]+)"'
    match = search(pattern, response.text)
    return f"https://{response.url.split('/')[2]}/{match.group(1)}" if match else False

if __name__ == "__main__":
    API_KEY = "TAKION_API_XXX" # Your api key here

    session = Session()
    url = "https://tickets.rolandgarros.com/fr/"
    headers = {
        'Host': 'tickets.rolandgarros.com',
        'cache-control': 'max-age=0',
        'sec-ch-ua': '"Google Chrome";v="112", "Chromium";v="112", "Not?A_Brand";v="24"',
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-platform': '"macOS"',
        'upgrade-insecure-requests': '1',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
        'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
        'sec-fetch-site': 'none',
        'sec-fetch-mode': 'navigate',
        'sec-fetch-user': '?1',
        'sec-fetch-dest': 'document',
        'accept-language': 'en-GB,en;q=0.9',
    }
    response = session.get(url, headers=headers)
    if not (challenge_url := is_challenge(response)):
        print("Page loaded successfully")
        exit(0)

    print(f"Found challenge, solving...")

    # Load challenge
    challenge = session.get(challenge_url, headers={
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'
    })

    # Solve the challenge
    takion_response = post(
        f"https://incapsula.takionapi.tech/utmvc?api_key={API_KEY}",
        json={
            "content": challenge.text,
            "cookies": [[name, value] for name, value in session.cookies.items()]
        },
        headers={
            'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'
        }
    ).json()
    if (error := takion_response.get("error")):
        print(f"Error: {error}")
        exit(1)
    
    # Set the utmvc cookie
    utmvc = takion_response["___utmvc"]
    session.cookies.set("___utmvc", utmvc)
    print(f"Got cookie: {utmvc[:15]}...{utmvc[-15:]}")
    # Now we send the original request again
    response = session.get(url, headers=headers)
    print(f"Challenge {'' if is_challenge(response) else 'not '}found using cookie")
Previous___utmvc Bypass SolutionNextCommon Errors & Troubleshooting

Last updated 8 months ago

Was this helpful?