Skip to main content

Synmax API client

Project description

Synmax API Client

Installation

If you just want to use the package, run:

pip install --upgrade synmax-api-python-client

Requirements

Make sure you have Python 3.7+ and pip installed.

Quickstart

Hyperion API Swagger doc: https://hyperion.api.synmax.com/apidocs/#/default

Jupyter notebook setting

run this block of code at the beggining of synmax api client
!pip install nest_asyncio

import nest_asyncio
nest_asyncio.apply()

After this run your code as usual.

Configuring synmax client

import logging
from synmax.hyperion import HyperionApiClient, ApiPayload

# enable debug if required.
logging.basicConfig(level=logging.DEBUG)

# two ways to pass access token.
# 1. Set environment variables: os.environ['access_token'] = 'your token'
# OR
# 2. pass to HyperionApiClient instance
access_token = 'your access token goes here'
hyperion_client = HyperionApiClient(access_token=access_token)

Fetching data based on your subscription key (access_key)

from synmax.hyperion import HyperionApiClient, ApiPayload

hyperion_client = HyperionApiClient(access_token='....')
# fetch regions
region_df = hyperion_client.fetch_regions()
print(region_df.count())

Paginated data

import logging
from synmax.hyperion import HyperionApiClient, ApiPayload

# enable debug if required.
logging.basicConfig(level=logging.DEBUG)

# two ways to pass access token.
# 1. Set environment variables: os.environ['access_token'] = 'your token'
# 2. pass to HyperionApiClient instance
access_token = 'your access token goes here'
hyperion_client = HyperionApiClient(access_token=access_token)

# well completion based on input filters of type ApiPayload; 
# fetch_all = True will paginate all of rows and return accumulation of each page result. True by default
# set fetch_all=False to get first page or any single page starting row with payload.pagination_start = <start row index, default to 0>
payload = ApiPayload(start_date='2022-06-1', end_date='2022-06-25', state_code='TX')

# return result is in pandas.DataFrame
completions_df = hyperion_client.well_completion(payload)
print(completions_df.count())
# output is in pandas.DataFrame
# Querying API pages: 100%|██████████| 8/8 [00:06<00:00,  1.14it/s]

# with optional payload to fetch full dataset
result_df = hyperion_client.wells()
print(result_df.count())
# Querying API wells pages:   0%|          | 4/7225 [00:16<8:51:17,  4.41s/it]


## Well data
result_df = hyperion_client.wells(payload)

## Product by Country and Operator
result_df = hyperion_client.production_by_county_and_operator(payload)

## Available api methods on hyperion_client
dir(hyperion_client)
# output: ['ducs_by_operator', 'fetch_regions', 'frac_crews', 'production_by_county_and_operator', 'production_by_well', 'rigs', 'well_completion', 'wells']

publishing package

pip install twine

python setup.py bdist_wheel 

twine upload dist/*


python setup.py clean --all

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

synmax_api_python_client-0.0.40-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file synmax_api_python_client-0.0.40-py3-none-any.whl.

File metadata

File hashes

Hashes for synmax_api_python_client-0.0.40-py3-none-any.whl
Algorithm Hash digest
SHA256 a07dcaf401be4a65bb5afa06d15117a0d125116f92ff19e3fa72ce47b46e7ae1
MD5 a0a5d756c7e53fbb055192a6246ee9cb
BLAKE2b-256 1bac5009e66921a36979d0b931163c22064a34c1e9b3bb13d994e35dd748702d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page