# Wrappers

Source: https://docs.scrappey.com/docs/wrappers

> Use the official Python or Node.js wrapper to interact with the Scrappey API without writing raw HTTP calls.

Scrappey offers official wrappers for both **Python** and **Node.js**, enabling developers to interact seamlessly with the Scrappey API. These wrappers simplify session management, request execution, browser workflows, and response parsing. ([GitHub](https://github.com/pim97))

## Python Wrapper

* **GitHub**: [pim97/scrappey-wrapper-python](https://github.com/pim97/scrappey-wrapper-python)
* **PyPI**: [scrappeycom](https://pypi.org/project/scrappeycom/)

### Installation

```bash
pip install scrappeycom
```

### Usage Example

```python
from scrappeycom.scrappey import Scrappey
import uuid

api_key = 'YOUR_API_KEY'
scrappey = Scrappey(api_key)

session_data = {
    'session': str(uuid.uuid4())
}

# Create a session
session = scrappey.create_session(session_data)
print('Session created:', session['session'])

# Make a GET request
response = scrappey.get({
    'session': session['session'],
    'url': 'https://httpbin.org/get'
})
print('GET Response:', response)

# Destroy the session
scrappey.destroy_session(session_data)
```

### Features

* Manages proxy configuration and response parsing
* Simplifies session creation and destruction
* Supports GET and POST requests with custom headers
* Provides error handling for common request issues

## Node.js Wrapper

* **GitHub**: [DemonMartin/scrappey-wrapper](https://github.com/DemonMartin/scrappey-wrapper)
* **NPM**: [scrappey](https://www.npmjs.com/package/scrappey)

### Installation

```bash
npm install scrappey
```

### Usage Example

```javascript
const Scrappey = require('scrappey');

const apiKey = 'YOUR_API_KEY';
const scrappey = new Scrappey(apiKey);

(async () => {
    // Create a session
    const sessionData = await scrappey.createSession();
    const session = sessionData.session;
    console.log('Session created:', session);

    // Make a GET request
    const response = await scrappey.getRequest({
        url: 'https://httpbin.org/get',
        session
    });
    console.log('GET Response:', response);

    // Destroy the session
    await scrappey.destroySession(session);
})();
```

### Features

* Manages proxy configuration and response parsing
* Manages sessions efficiently
* Supports both form data and JSON in POST requests
* Allows custom headers for requests

## Notes

For more detailed information and advanced usage, refer to the respective GitHub repositories:

* [scrappey-wrapper-python](https://github.com/pim97/scrappey-wrapper-python)
* [scrappey-wrapper](https://github.com/DemonMartin/scrappey-wrapper)

These wrappers are designed to streamline your web scraping tasks using Scrappey's powerful API.
