Metadata-Version: 2.4
Name: whitson-plus-connect
Version: 0.1.0
Summary: Python SDK helpers for the whitson+ external API.
Author-email: Whitson AS <support@whitson.com>, Konrad Hogstad Johannessen <konrad@whitson.com>
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:

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

Values set with `export` are available only in that terminal session and to programs started from that terminal.

```python
import os

from whitson_plus_connect import WhitsonClient

client = WhitsonClient.from_env().authenticate()
wells = client.wells.list(int(os.environ["WHITSON_PROJECT_ID"]))
well = client.wells.get(well_id=123)
```

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_sql(...)
client.databricks.connect(...)
client.databricks.connect_oauth2(...)

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/
