Metadata-Version: 2.4
Name: whitson-plus-connect
Version: 0.1.1
Summary: Python SDK helpers for the whitson+ external API.
Author: Whitson AS, Konrad Hogstad Johannessen
Maintainer-email: Whitson Support <support@whitson.com>
License-Expression: MIT
Project-URL: Homepage, https://whitson.com
Project-URL: Documentation, https://manual.whitson.com/external_api/sdk/
Project-URL: External API Manual, https://manual.whitson.com/external_api/overview/
Project-URL: Support, https://manual.whitson.com/contact_us/
Keywords: whitson,whitson+,external api,petroleum engineering,production data,reservoir engineering
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<3,>=1.26
Requires-Dist: pandas<3,>=2.2.3
Requires-Dist: requests<3,>=2.32.4
Provides-Extra: snowflake
Requires-Dist: cryptography>=46.0.5; extra == "snowflake"
Requires-Dist: snowflake-sqlalchemy<2,>=1.10; extra == "snowflake"
Requires-Dist: SQLAlchemy<3,>=1.4.19; extra == "snowflake"
Provides-Extra: databricks
Requires-Dist: databricks-sql-connector<5,>=4.3; extra == "databricks"
Provides-Extra: odbc
Requires-Dist: pyodbc; extra == "odbc"
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# whitson+ Connect SDK

Python SDK for the whitson+ external API.

Use this package to authenticate with whitson<sup>+</sup>, read well and production data, upload production data, update wells, and connect whitson<sup>+</sup> to database workflows.

## Install

Install it with:

```bash
pip install whitson-plus-connect
```

For Databricks SQL connector workflows:

```bash
pip install "whitson-plus-connect[databricks]"
```

For Snowflake workflows:

```bash
pip install "whitson-plus-connect[snowflake]"
```

For SQL Server or other ODBC workflows:

```bash
pip install "whitson-plus-connect[odbc]"
```

## Usage

Set your API credentials as environment variables using the commands for your
terminal. These commands set the values for the current terminal session and for
programs started from that terminal.

macOS, Linux, or Git Bash:

```bash
export WHITSON_CLIENT_NAME="your_domain"
export WHITSON_CLIENT_ID="your_client_id"
export WHITSON_CLIENT_SECRET="your_client_secret"
```

Windows PowerShell:

```powershell
$env:WHITSON_CLIENT_NAME = "your_domain"
$env:WHITSON_CLIENT_ID = "your_client_id"
$env:WHITSON_CLIENT_SECRET = "your_client_secret"
```

Windows Command Prompt:

```batch
set WHITSON_CLIENT_NAME=your_domain
set WHITSON_CLIENT_ID=your_client_id
set WHITSON_CLIENT_SECRET=your_client_secret
```


```python
from whitson_plus_connect import WhitsonClient

client = WhitsonClient.from_env().authenticate()
wells = client.wells.list(project_id=123)
well = client.wells.get(well_id=123)
```

Or pass credentials directly in Python:

```python
from whitson_plus_connect import WhitsonClient

client = WhitsonClient.from_credentials(
    client_name="your_domain",
    client_id="your_client_id",
    client_secret="your_client_secret",
).authenticate()
```

Existing `whitson_connect` workflows can keep using `WhitsonConnection` directly:

```python
from whitson_plus_connect import WhitsonConnection

whitson_connection = WhitsonConnection(
    client_name="your_domain",
    client_id="your_client_id",
    client_secret="your_client_secret",
)
whitson_connection.authenticate()
```

When using `WhitsonClient`, the underlying `WhitsonConnection` is still available as `client.connection` for scripts that need the original Whitson Connect method names.

## Database integrations

Database helpers are available through the SDK client:

```python
client.snowflake.connect(...)
client.snowflake.query_to_dataframe(...)

client.databricks.connect(...)

client.prodman.get_wells(...)
client.prodman.get_production(...)
```

Install the matching optional dependency before using these helpers:

```bash
pip install "whitson-plus-connect[snowflake]"
pip install "whitson-plus-connect[databricks]"
pip install "whitson-plus-connect[odbc]"
```

## Documentation

See the whitson<sup>+</sup> external API manual for setup steps and workflow examples:

https://manual.whitson.com/external_api/sdk/
