Getting Started#
Installation and configuration of the SynMax/Hyperion API Client:
Installation#
pip install --upgrade synmax-api-python-client
Requirements#
Before you install the client, make sure you have Python 3.7+ and pip installed.
Additionally, the following dependency packages will automatically be installed alongside synmax-api-python-client: aioretry, aiohttp, nest_asyncio, pandas, pydantic, tqdm, urllib3, wheel.
To install these dependencies yourself, run:
pip install aiohttp aioretry nest_asyncio pandas pydantic tqdm urllib3 wheel
Jupyter Notebooks#
If you are using Jupyter Notebooks, please install the nest_asyncio package in order for async to work correctly:
!pip install nest_asyncio
To use the package, simply import it in your Python project and apply the patch.
import nest_asyncio
nest_asyncio.apply()
Note
In Python versions <3.7 you need to call apply()
before importing nest_asyncio and in Python 3.7+ you call it after importing nest_asyncio.
Quickstart#
Configuration of the Hyperion/Synmax client is a simple step-by-step process.
⮞ Import modules#
from synmax.hyperion import HyperionApiClient, ApiPayload
⮞ Pass an access token#
There are two ways to pass the access token:
A. Set an environment variable
os.environ['access_token'] = 'your token'
OR
B. Pass the access token to the HyperionApiClient instance
access_token = 'your access token goes here'
client = HyperionApiClient(access_token=access_token)
For more information on access tokens, please see the section on Authentication.
⮞ Enable logging#
Logging may be enabled if required…
logging.basicConfig(level=logging.DEBUG)
To read more about logging, please see the Python documentation.
⮞ Fetch data#
# to fetch region data:
region_df = client.fetch_regions()
print(region_df)
To see all available API methods…
print(dir(client))
# output: ['completions', 'dailyfrackedfeet', 'dailyproduction', 'ducsbyoperator', 'fraccrews', 'longtermforecast', 'operatorclassification', 'productionbywell', 'regions', 'rigs', 'shorttermforecast', 'shorttermforecasthistory', 'wells']
Note
The Hyperion/Synmax client returns objects in a pandas DataFrame. To understand more about interacting with DataFrames, please see the pandas documentation.
A complete example#
This example fetches data on wells.
1import logging
2from synmax.hyperion import HyperionApiClient, ApiPayload
3
4logging.basicConfig(level=logging.DEBUG)
5
6access_token = 'your token'
7client = HyperionApiClient(access_token=access_token)
8payload = ApiPayload(start_date="2022-05-01", end_date="2022-07-01", state_code=['CO','TX'])
9
10result_df = client.wells(payload)
11print(result_df)