takion-api


Nametakion-api JSON
Version 0.1.32 PyPI version JSON
download
home_pagehttps://github.com/Takion-API-Services/takion-api
SummaryOfficial Python wrapper for TakionAPI services, designed for efficient automation and bypass of advanced antibot systems.
upload_time2024-01-23 01:25:37
maintainer
docs_urlNone
authorglizzykingdreko
requires_python>=3.6
license
keywords takion-api takion datadome antibot bypass
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # takion-api
This is the official repository for the TakionAPI Python library. TakionAPI is a non-browser-based automation solution focused antibot and captchas systems.

![TakionAPI](https://takionapi.tech/banner)

<p align="center">
    <a href="https://pypi.org/project/takion-api/">
        <img src="https://img.shields.io/pypi/v/takion-api.svg" alt="PyPI Version"/>
    </a>
    <a href="https://github.com/Takion-API-Services/takion-api/stargazers">
        <img src="https://img.shields.io/github/stars/Takion-API-Services/takion-api.svg?style=social&label=Star" alt="GitHub Stars"/>
    </a>
</p>

## Table of Contents
- [takion-api](#takion-api)
  - [Table of Contents](#table-of-contents)
  - [Revolutionizing Antibot Interactions](#revolutionizing-antibot-interactions)
  - [Get Your Free Trial API Key](#get-your-free-trial-api-key)
  - [Installation](#installation)
  - [Future Extensions](#future-extensions)
  - [Antibots](#antibots)
    - [Datadome](#datadome)
      - [Datadome challenges](#datadome-challenges)
        - [Geetest - Slide captcha](#geetest---slide-captcha)
        - [Interstitial - Device check](#interstitial---device-check)
      - [Usage](#usage)
    - [Incapsula](#incapsula)
      - [\_\_\_utmvc](#___utmvc)
        - [Usage](#usage-1)
      - [reese84](#reese84)
        - [Usage](#usage-2)
    - [Exceptions](#exceptions)
  - [Support and Links](#support-and-links)

## Revolutionizing Antibot Interactions
TakionAPI stands at the forefront of antibot solutions, offering a robust and efficient way to bypass advanced bot protection systems like Datadome. Renowned for its non-browser-based approach, it ensures high-speed, accurate automation across various browser OS/versions. TakionAPI is committed to providing 24/7 uninterrupted service, adapting swiftly to changes in antibot technologies.

Key Features:
- **Non-Browser Automation:** For faster, error-free interactions.
- **Universal Browser Support:** Compatible with all browser OS/versions.
- **Continuous Service:** Round-the-clock availability and updates.
- **Free Trials & Comprehensive Plans:** Accessible, cost-effective solutions for every need.
- **Easy Integration:** Complete with documentation, libraries, and examples.
- **Dedicated Server Options:** Tailored solutions for specific requirements.
- **Community & Support:** Active Discord community and responsive support.

[Explore More](https://docs.takionapi.tech)

## Get Your Free Trial API Key
Start with a free trial by visiting [TakionAPI.tech](https://takionapi.tech). Join the [Discord community](https://takionapi.tech/discord) to acquire a trial key or subscription.

## Installation
Install the library using pip:
```bash
pip install takion-api
```

## Future Extensions
The current implementation of the takion-api module focuses on making the interactions with Datadome websites easier using out APIs.

However, we already support several bot protections solved with our APIs, are planning to extend this module to handle all the supported antibots.

For now you can interact with them using our [API](https://docs.takionapi.tech) directly.

## Antibots 

### Datadome
Datadome is a bot management system that protects websites from automated threats, including scraping, credential stuffing, and layer 7 (application layer) DDoS attacks. 

It's known for its inefficiency in detecting and blocking bots, resulting in false positives and IP bans for legitimate users.

Datadome is particularly sensitive to TLS fingerprinting and headers order, making it crucial to emulate a genuine browser's TLS signatures and headers sequence for successful bypass. 

Therefore, it's advisable to have a robust proxy list to rotate IPs and avoid IP bans.

[Learn More](https://docs.takionapi.tech/datadome/docs)

#### Datadome challenges
In order to access a Datadome website under protection you may need on first join or after some requests to solve a challenge that will generate you a `datadome` cookie that will garant you the access to the website for a certain amount of time.

##### Geetest - Slide captcha
This is a slide captcha that requires the user to slide a puzzle piece to a target location.
![SlideCaptcha](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fn0x4RrnIfxXvmfh6rJHh%2Fuploads%2F7oP27wbOKRLmDaDsLEhw%2FScreenshot%202023-12-12%20at%2014.43.11.png?alt=media&token=93b4ff62-c1b4-4023-bb70-0dc70177e56c)

##### Interstitial - Device check
This is the newest challenge, that similar to the Cloudflare 5s page, is going to make some checks on the browser.
![DeviceCheck](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fn0x4RrnIfxXvmfh6rJHh%2Fuploads%2FDBJewaVe0AhrMLYEaSgJ%2FScreenshot%202023-12-12%20at%2014.38.16.png?alt=media&token=0483815e-f2c6-48ec-96d3-27cd30bff5d3)


#### Usage
```python
from tls_client import Session
from takion_api import TakionAPIDatadome


def load_page(session: Session, url: str):
    headers = {
        "authority": url.split("/")[2],
        "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",
        "sec-ch-ua": '"Google Chrome";v="110", "Chromium";v="110", "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": "none",
        "sec-fetch-user": "?1",
        "upgrade-insecure-requests": "1",
        "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
    }
    return session.get(url, headers=headers)


if __name__ == "__main__":
    takion_api = TakionAPIDatadome(
        api_key="TAKION_API_XXXXXX", # Your TakionAPI key
    )
    session = Session(
        "chrome_110", 
        header_order=[ # The order of the headers is important
            'Host', 'Connection', 'Content-Length', 
            'sec-ch-ua', 'sec-ch-ua-platform', 
            'sec-ch-ua-mobile', 'User-Agent', 
            'Content-Type', 'Accept', 'Origin', 
            'Sec-Fetch-Site', 'Sec-Fetch-Mode', 
            'Sec-Fetch-Dest', 'Referer', 'Accept-Encoding', 
            'Accept-Language'
        ]
    )

    # An example Datadome protected page
    url = "https://www.footlocker.pt/en/product/~/314206535404.html"
    
    response = load_page(session, url)
    if not takion_api.is_challenge(response): # Check if we need to solve a challenge
        print("Page loaded successfully")
        exit(0)
    
    print(f"Got a response with status code {response.status_code} without the cookie")

    # This function will return the url of the challenge
    # no matter if it's a slide captcha or an interstital
    challenge_url = takion_api.get_challenge_url(
        url,
        response,
        session.cookies.get_dict().get("datadome")
    )
    print(f"Solving {takion_api.challenge_type} challenge...")

    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",
        "Accept-Encoding": "none",
        "Connection": "keep-alive",
        "Referer": "https://www.footlocker.pt/",
        "Sec-Fetch-Dest": "iframe",
        "Sec-Fetch-Mode": "navigate",
        "Sec-Fetch-Site": "cross-site",
        "Upgrade-Insecure-Requests": "1",
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
        "sec-ch-ua": '"Google Chrome";v="110", "Chromium";v="110", "Not?A_Brand";v="24"',
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"macOS\""
    }
    
    # After that we are going to load the challenge page
    response = session.get(challenge_url, headers=headers)

    # And send to TakionAPI the content, in order to solve any present challenge
    data = takion_api.solve_challenge(
        response
    )

    # TakionAPI will return a dict with the url, payload and headers
    # for the POST request that we need to send to the challenge page
    # in order to generate the cookie
    res = session.post(
        data["url"], 
        data=data["payload"], 
        headers=data["headers"]
    )

    # We extract the cookie from the response
    cookie = TakionAPIDatadome.extract_cookie(res)

    # And set it in the session
    session.cookies.set("datadome", cookie)
    print(f"Got cookie: {cookie[:15]}...{cookie[-15:]}")

    # Now we can load the page with the cookie
    print("Loading page with cookie...")
    response = load_page(session, url)
    print(f"Got a response with status code {response.status_code} with the cookie")
```


### Incapsula
Incapsula is a cloud-based application delivery platform that protects websites from DDoS, SQL injection, XSS, and other cyber attacks.

Like datadome it is important to use a good proxy list to avoid IP bans, as well as a good TLS fingerprinting and headers order.

They uses 2 types of protections:

*Read more here [Takion API Incapsula](https://docs.takionapi.tech/incapsula/incapsula-documentation)*

#### ___utmvc
An `___utmvc` cookie is generated when a user visits a website protected by Incapsula. It's used to identify the user and validate the request.

##### Usage
```python

from requests import Session
from takion_api import TakionAPIUtmvc

session = Session()
takion_api = TakionAPIUtmvc(
    api_key="TAKION_API_XXXXXXXX"
)
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 takion_api.is_challenge(response):
    print("Page loaded successfully")
else:
    print("Found challenge, solving...")
    # Solve the challenge
    utmvc = takion_api.solve_challenge(
        response,
        cookies=session.cookies # Optional but recommended
    )
    # Set the utmvc cookie
    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 takion_api.is_challenge(response) else 'not '}found using cookie")
```

#### reese84
A `reese84` cookie is generated when a user visits a website protected by Incapsula. A payload will be needed in order to generate the cookie via a post.
Websites like ticketmaster and eticketing uses this type of protection.

##### Usage
```python
from requests import Session
from takion_api import TakionAPIReese84

takion_api = TakionAPIReese84(
    api_key="TAKION_API_XXXXXXXX"
)

protected_url = "https://www.ticketmaster.com/event/1C005E959B003CA9"
headers = {
    "Host": "www.ticketmaster.com",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-ch-ua-mobile": "?0",
    "upgrade-insecure-requests": "1",
    "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",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
    "sec-fetch-mode": "navigate",
    "sec-fetch-dest": "document",
    "sec-ch-ua": '"Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"',
    "sec-fetch-site": "same-site",
    "sec-fetch-user": "?1",
    "accept-language": "en-US,en;q=0.9"
}

def send_request_with_solving() -> None:
    '''
    Send request to protected url after solving the challenge
    '''
    # Create a new session
    session = Session()
    print("Loading page with solved reese84...")

    # Generate payload
    data = takion_api.solve_challenge("www.ticketmaster.com", headers["user-agent"])
    
    # Send challenge
    res = session.post(
        data["url"], 
        data=data["payload"], 
        headers=data["headers"]
    ).json()
    
    # Set cookie
    session.cookies.set("reese84", res['token'])
    print(f"Got cookie: {res['token'][:15]}...{res['token'][-15:]}")

    # Sending request to protected url 
    res = session.get(protected_url, headers=headers)
    print(f"Response {'not ' if not TakionAPIReese84.is_challenge(res) else ''}blocked (Status code {res.status_code})")

def send_request_without_solving() -> None:
    '''
    Send request to protected url without solving the challenge
    '''
    # Create a new session
    session = Session()
    print("Loading page without solving the challenge...")

    # Sending request to protected url
    res = session.get(protected_url, headers=headers)
    print(f"Response {'not ' if not TakionAPIReese84.is_challenge(res) else ''}blocked (Status code {res.status_code})")

if __name__ == "__main__":
    send_request_without_solving() # Will return 403 or 401
    print("-----------------------------------")
    send_request_with_solving() # Will return 404, old event
```

### Exceptions
- `TakionAPIException`: Generic exception
- `BadResponseException`: Raised when the response is not a valid response, error solving or wrong parameters provided
- `IpBanException`: Raised when the IP is banned

## Support and Links
- [TakionAPI.tech](https://takionapi.tech)
- [Documentation](https://docs.takionapi.tech)
- [Discord / Start a trial](https://takionapi.tech/discord)
- [Buy a plan](https://takionapi.tech/buy)
- [GitHub](https://github.com/Takion-API-Services)

For any question or issue, please contact us on [Discord](https://takionapi.tech/discord).

----

TakionAPI is a product of [Takion Labs](https://takionapi.com/), a leading provider of automation solutions for businesses and individuals.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Takion-API-Services/takion-api",
    "name": "takion-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "takion-api,takion,datadome,antibot,bypass",
    "author": "glizzykingdreko",
    "author_email": "glizzykingdreko@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4e/07/b392e8b886a219e8842c7015142593127e3af670a59bd8be0313f49ef19d/takion_api-0.1.32.tar.gz",
    "platform": null,
    "description": "# takion-api\nThis is the official repository for the TakionAPI Python library. TakionAPI is a non-browser-based automation solution focused antibot and captchas systems.\n\n![TakionAPI](https://takionapi.tech/banner)\n\n<p align=\"center\">\n    <a href=\"https://pypi.org/project/takion-api/\">\n        <img src=\"https://img.shields.io/pypi/v/takion-api.svg\" alt=\"PyPI Version\"/>\n    </a>\n    <a href=\"https://github.com/Takion-API-Services/takion-api/stargazers\">\n        <img src=\"https://img.shields.io/github/stars/Takion-API-Services/takion-api.svg?style=social&label=Star\" alt=\"GitHub Stars\"/>\n    </a>\n</p>\n\n## Table of Contents\n- [takion-api](#takion-api)\n  - [Table of Contents](#table-of-contents)\n  - [Revolutionizing Antibot Interactions](#revolutionizing-antibot-interactions)\n  - [Get Your Free Trial API Key](#get-your-free-trial-api-key)\n  - [Installation](#installation)\n  - [Future Extensions](#future-extensions)\n  - [Antibots](#antibots)\n    - [Datadome](#datadome)\n      - [Datadome challenges](#datadome-challenges)\n        - [Geetest - Slide captcha](#geetest---slide-captcha)\n        - [Interstitial - Device check](#interstitial---device-check)\n      - [Usage](#usage)\n    - [Incapsula](#incapsula)\n      - [\\_\\_\\_utmvc](#___utmvc)\n        - [Usage](#usage-1)\n      - [reese84](#reese84)\n        - [Usage](#usage-2)\n    - [Exceptions](#exceptions)\n  - [Support and Links](#support-and-links)\n\n## Revolutionizing Antibot Interactions\nTakionAPI stands at the forefront of antibot solutions, offering a robust and efficient way to bypass advanced bot protection systems like Datadome. Renowned for its non-browser-based approach, it ensures high-speed, accurate automation across various browser OS/versions. TakionAPI is committed to providing 24/7 uninterrupted service, adapting swiftly to changes in antibot technologies.\n\nKey Features:\n- **Non-Browser Automation:** For faster, error-free interactions.\n- **Universal Browser Support:** Compatible with all browser OS/versions.\n- **Continuous Service:** Round-the-clock availability and updates.\n- **Free Trials & Comprehensive Plans:** Accessible, cost-effective solutions for every need.\n- **Easy Integration:** Complete with documentation, libraries, and examples.\n- **Dedicated Server Options:** Tailored solutions for specific requirements.\n- **Community & Support:** Active Discord community and responsive support.\n\n[Explore More](https://docs.takionapi.tech)\n\n## Get Your Free Trial API Key\nStart with a free trial by visiting [TakionAPI.tech](https://takionapi.tech). Join the [Discord community](https://takionapi.tech/discord) to acquire a trial key or subscription.\n\n## Installation\nInstall the library using pip:\n```bash\npip install takion-api\n```\n\n## Future Extensions\nThe current implementation of the takion-api module focuses on making the interactions with Datadome websites easier using out APIs.\n\nHowever, we already support several bot protections solved with our APIs, are planning to extend this module to handle all the supported antibots.\n\nFor now you can interact with them using our [API](https://docs.takionapi.tech) directly.\n\n## Antibots \n\n### Datadome\nDatadome is a bot management system that protects websites from automated threats, including scraping, credential stuffing, and layer 7 (application layer) DDoS attacks. \n\nIt's known for its inefficiency in detecting and blocking bots, resulting in false positives and IP bans for legitimate users.\n\nDatadome is particularly sensitive to TLS fingerprinting and headers order, making it crucial to emulate a genuine browser's TLS signatures and headers sequence for successful bypass. \n\nTherefore, it's advisable to have a robust proxy list to rotate IPs and avoid IP bans.\n\n[Learn More](https://docs.takionapi.tech/datadome/docs)\n\n#### Datadome challenges\nIn order to access a Datadome website under protection you may need on first join or after some requests to solve a challenge that will generate you a `datadome` cookie that will garant you the access to the website for a certain amount of time.\n\n##### Geetest - Slide captcha\nThis is a slide captcha that requires the user to slide a puzzle piece to a target location.\n![SlideCaptcha](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fn0x4RrnIfxXvmfh6rJHh%2Fuploads%2F7oP27wbOKRLmDaDsLEhw%2FScreenshot%202023-12-12%20at%2014.43.11.png?alt=media&token=93b4ff62-c1b4-4023-bb70-0dc70177e56c)\n\n##### Interstitial - Device check\nThis is the newest challenge, that similar to the Cloudflare 5s page, is going to make some checks on the browser.\n![DeviceCheck](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fn0x4RrnIfxXvmfh6rJHh%2Fuploads%2FDBJewaVe0AhrMLYEaSgJ%2FScreenshot%202023-12-12%20at%2014.38.16.png?alt=media&token=0483815e-f2c6-48ec-96d3-27cd30bff5d3)\n\n\n#### Usage\n```python\nfrom tls_client import Session\nfrom takion_api import TakionAPIDatadome\n\n\ndef load_page(session: Session, url: str):\n    headers = {\n        \"authority\": url.split(\"/\")[2],\n        \"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\",\n        \"accept-language\": \"en-GB,en;q=0.9\",\n        \"cache-control\": \"max-age=0\",\n        \"sec-ch-ua\": '\"Google Chrome\";v=\"110\", \"Chromium\";v=\"110\", \"Not?A_Brand\";v=\"99\"',\n        \"sec-ch-ua-mobile\": \"?0\",\n        \"sec-ch-ua-platform\": \"\\\"macOS\\\"\",\n        \"sec-fetch-dest\": \"document\",\n        \"sec-fetch-mode\": \"navigate\",\n        \"sec-fetch-site\": \"none\",\n        \"sec-fetch-user\": \"?1\",\n        \"upgrade-insecure-requests\": \"1\",\n        \"user-agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36\"\n    }\n    return session.get(url, headers=headers)\n\n\nif __name__ == \"__main__\":\n    takion_api = TakionAPIDatadome(\n        api_key=\"TAKION_API_XXXXXX\", #\u00a0Your TakionAPI key\n    )\n    session = Session(\n        \"chrome_110\", \n        header_order=[ # The order of the headers is important\n            'Host', 'Connection', 'Content-Length', \n            'sec-ch-ua', 'sec-ch-ua-platform', \n            'sec-ch-ua-mobile', 'User-Agent', \n            'Content-Type', 'Accept', 'Origin', \n            'Sec-Fetch-Site', 'Sec-Fetch-Mode', \n            'Sec-Fetch-Dest', 'Referer', 'Accept-Encoding', \n            'Accept-Language'\n        ]\n    )\n\n    #\u00a0An example Datadome protected page\n    url = \"https://www.footlocker.pt/en/product/~/314206535404.html\"\n    \n    response = load_page(session, url)\n    if not takion_api.is_challenge(response): #\u00a0Check if we need to solve a challenge\n        print(\"Page loaded successfully\")\n        exit(0)\n    \n    print(f\"Got a response with status code {response.status_code} without the cookie\")\n\n    # This function will return the url of the challenge\n    # no matter if it's a slide captcha or an interstital\n    challenge_url = takion_api.get_challenge_url(\n        url,\n        response,\n        session.cookies.get_dict().get(\"datadome\")\n    )\n    print(f\"Solving {takion_api.challenge_type} challenge...\")\n\n    headers = {\n        \"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\",\n        \"Accept-Language\": \"en-GB,en;q=0.9\",\n        \"Accept-Encoding\": \"none\",\n        \"Connection\": \"keep-alive\",\n        \"Referer\": \"https://www.footlocker.pt/\",\n        \"Sec-Fetch-Dest\": \"iframe\",\n        \"Sec-Fetch-Mode\": \"navigate\",\n        \"Sec-Fetch-Site\": \"cross-site\",\n        \"Upgrade-Insecure-Requests\": \"1\",\n        \"User-Agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36\",\n        \"sec-ch-ua\": '\"Google Chrome\";v=\"110\", \"Chromium\";v=\"110\", \"Not?A_Brand\";v=\"24\"',\n        \"sec-ch-ua-mobile\": \"?0\",\n        \"sec-ch-ua-platform\": \"\\\"macOS\\\"\"\n    }\n    \n    # After that we are going to load the challenge page\n    response = session.get(challenge_url, headers=headers)\n\n    # And send to TakionAPI the content, in order to solve any present challenge\n    data = takion_api.solve_challenge(\n        response\n    )\n\n    # TakionAPI will return a dict with the url, payload and headers\n    # for the POST request that we need to send to the challenge page\n    # in order to generate the cookie\n    res = session.post(\n        data[\"url\"], \n        data=data[\"payload\"], \n        headers=data[\"headers\"]\n    )\n\n    #\u00a0We extract the cookie from the response\n    cookie = TakionAPIDatadome.extract_cookie(res)\n\n    #\u00a0And set it in the session\n    session.cookies.set(\"datadome\", cookie)\n    print(f\"Got cookie: {cookie[:15]}...{cookie[-15:]}\")\n\n    #\u00a0Now we can load the page with the cookie\n    print(\"Loading page with cookie...\")\n    response = load_page(session, url)\n    print(f\"Got a response with status code {response.status_code} with the cookie\")\n```\n\n\n### Incapsula\nIncapsula is a cloud-based application delivery platform that protects websites from DDoS, SQL injection, XSS, and other cyber attacks.\n\nLike datadome it is important to use a good proxy list to avoid IP bans, as well as a good TLS fingerprinting and headers order.\n\nThey uses 2 types of protections:\n\n*Read more here [Takion API Incapsula](https://docs.takionapi.tech/incapsula/incapsula-documentation)*\n\n#### ___utmvc\nAn `___utmvc` cookie is generated when a user visits a website protected by Incapsula. It's used to identify the user and validate the request.\n\n##### Usage\n```python\n\nfrom requests import Session\nfrom takion_api import TakionAPIUtmvc\n\nsession = Session()\ntakion_api = TakionAPIUtmvc(\n    api_key=\"TAKION_API_XXXXXXXX\"\n)\nurl = \"https://tickets.rolandgarros.com/fr/\"\nheaders = {\n    'Host': 'tickets.rolandgarros.com',\n    'cache-control': 'max-age=0',\n    'sec-ch-ua': '\"Google Chrome\";v=\"112\", \"Chromium\";v=\"112\", \"Not?A_Brand\";v=\"24\"',\n    'sec-ch-ua-mobile': '?0',\n    'sec-ch-ua-platform': '\"macOS\"',\n    'upgrade-insecure-requests': '1',\n    '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',\n    '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',\n    'sec-fetch-site': 'none',\n    'sec-fetch-mode': 'navigate',\n    'sec-fetch-user': '?1',\n    'sec-fetch-dest': 'document',\n    'accept-language': 'en-GB,en;q=0.9',\n}\nresponse = session.get(url, headers=headers)\nif not takion_api.is_challenge(response):\n    print(\"Page loaded successfully\")\nelse:\n    print(\"Found challenge, solving...\")\n    # Solve the challenge\n    utmvc = takion_api.solve_challenge(\n        response,\n        cookies=session.cookies # Optional but recommended\n    )\n    # Set the utmvc cookie\n    session.cookies.set(\"___utmvc\", utmvc)\n    print(f\"Got cookie: {utmvc[:15]}...{utmvc[-15:]}\")\n    # Now we send the original request again\n    response = session.get(url, headers=headers)\n    print(f\"Challenge {'' if takion_api.is_challenge(response) else 'not '}found using cookie\")\n```\n\n#### reese84\nA `reese84` cookie is generated when a user visits a website protected by Incapsula. A payload will be needed in order to generate the cookie via a post.\nWebsites like ticketmaster and eticketing uses this type of protection.\n\n##### Usage\n```python\nfrom requests import Session\nfrom takion_api import TakionAPIReese84\n\ntakion_api = TakionAPIReese84(\n    api_key=\"TAKION_API_XXXXXXXX\"\n)\n\nprotected_url = \"https://www.ticketmaster.com/event/1C005E959B003CA9\"\nheaders = {\n    \"Host\": \"www.ticketmaster.com\",\n    \"sec-ch-ua-platform\": \"\\\"Windows\\\"\",\n    \"sec-ch-ua-mobile\": \"?0\",\n    \"upgrade-insecure-requests\": \"1\",\n    \"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\",\n    \"user-agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36\",\n    \"sec-fetch-mode\": \"navigate\",\n    \"sec-fetch-dest\": \"document\",\n    \"sec-ch-ua\": '\"Chromium\";v=\"110\", \"Not A(Brand\";v=\"24\", \"Google Chrome\";v=\"110\"',\n    \"sec-fetch-site\": \"same-site\",\n    \"sec-fetch-user\": \"?1\",\n    \"accept-language\": \"en-US,en;q=0.9\"\n}\n\ndef send_request_with_solving() -> None:\n    '''\n    Send request to protected url after solving the challenge\n    '''\n    # Create a new session\n    session = Session()\n    print(\"Loading page with solved reese84...\")\n\n    # Generate payload\n    data = takion_api.solve_challenge(\"www.ticketmaster.com\", headers[\"user-agent\"])\n    \n    # Send challenge\n    res = session.post(\n        data[\"url\"], \n        data=data[\"payload\"], \n        headers=data[\"headers\"]\n    ).json()\n    \n    # Set cookie\n    session.cookies.set(\"reese84\", res['token'])\n    print(f\"Got cookie: {res['token'][:15]}...{res['token'][-15:]}\")\n\n    # Sending request to protected url \n    res = session.get(protected_url, headers=headers)\n    print(f\"Response {'not ' if not TakionAPIReese84.is_challenge(res) else ''}blocked (Status code {res.status_code})\")\n\ndef send_request_without_solving() -> None:\n    '''\n    Send request to protected url without solving the challenge\n    '''\n    # Create a new session\n    session = Session()\n    print(\"Loading page without solving the challenge...\")\n\n    # Sending request to protected url\n    res = session.get(protected_url, headers=headers)\n    print(f\"Response {'not ' if not TakionAPIReese84.is_challenge(res) else ''}blocked (Status code {res.status_code})\")\n\nif __name__ == \"__main__\":\n    send_request_without_solving() # Will return 403 or 401\n    print(\"-----------------------------------\")\n    send_request_with_solving() # Will return 404, old event\n```\n\n### Exceptions\n- `TakionAPIException`: Generic exception\n- `BadResponseException`: Raised when the response is not a valid response, error solving or wrong parameters provided\n- `IpBanException`: Raised when the IP is banned\n\n## Support and Links\n- [TakionAPI.tech](https://takionapi.tech)\n- [Documentation](https://docs.takionapi.tech)\n- [Discord / Start a trial](https://takionapi.tech/discord)\n- [Buy a plan](https://takionapi.tech/buy)\n- [GitHub](https://github.com/Takion-API-Services)\n\nFor any question or issue, please contact us on [Discord](https://takionapi.tech/discord).\n\n----\n\nTakionAPI is a product of [Takion Labs](https://takionapi.com/), a leading provider of automation solutions for businesses and individuals.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Official Python wrapper for TakionAPI services, designed for efficient automation and bypass of advanced antibot systems.",
    "version": "0.1.32",
    "project_urls": {
        "Homepage": "https://github.com/Takion-API-Services/takion-api"
    },
    "split_keywords": [
        "takion-api",
        "takion",
        "datadome",
        "antibot",
        "bypass"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e8e1d281647a4d6fc2249d2757cc30c1dc0da7d02cc886767dbbe618f66cbba7",
                "md5": "ee220caa17ca777cd867fcfb9e70cf4f",
                "sha256": "59e1b60d7aa16a9d667e51ce230efb2e222d03c79046ec1123417b49a71b8b71"
            },
            "downloads": -1,
            "filename": "takion_api-0.1.32-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ee220caa17ca777cd867fcfb9e70cf4f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 18533,
            "upload_time": "2024-01-23T01:25:34",
            "upload_time_iso_8601": "2024-01-23T01:25:34.499693Z",
            "url": "https://files.pythonhosted.org/packages/e8/e1/d281647a4d6fc2249d2757cc30c1dc0da7d02cc886767dbbe618f66cbba7/takion_api-0.1.32-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e07b392e8b886a219e8842c7015142593127e3af670a59bd8be0313f49ef19d",
                "md5": "471524a6f6fab26c4f3e4743b867217b",
                "sha256": "03235b93cee48ff16b39291bf532303fa786c5652ed85b0d7241c8271474aaa6"
            },
            "downloads": -1,
            "filename": "takion_api-0.1.32.tar.gz",
            "has_sig": false,
            "md5_digest": "471524a6f6fab26c4f3e4743b867217b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 16002,
            "upload_time": "2024-01-23T01:25:37",
            "upload_time_iso_8601": "2024-01-23T01:25:37.934625Z",
            "url": "https://files.pythonhosted.org/packages/4e/07/b392e8b886a219e8842c7015142593127e3af670a59bd8be0313f49ef19d/takion_api-0.1.32.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-23 01:25:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Takion-API-Services",
    "github_project": "takion-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "takion-api"
}
        
Elapsed time: 0.40632s