# petropylib

This is a library that helps users interact with the Petro.ai API in python. The motivation behind this package is to allow for a petroclient and allow users to interact freely with against the Petro.ai API.

# Installation

Clone the package from the Petro.ai scripts repo (you will need to be prepared to enter Microsoft credentials):

git clone "https://ruths@dev.azure.com/ruths/public-projects/_git/petroPyLib"
cd petroPyLib

Or you can attempt to clone in Visual Studio Code


In PowerShell, CD into petropylib (the root folder) and type:

pip install .

# A Quick Example

## First we'll import the petroclient
from petropylib import petroclient

## Then we'll need the inputs to authenticate our petro-session
petrourl = 'petro-url/api'
ptoken = "petroai token"
petronId = 'petronId'

client = petroclient.PetroClient(petrourl, token = ptoken)
petrons = client.get_petrons(PID = petronId)

## Grab well forecast data
petronOfChoice = petrons[0]
wellOfChoice = petronOfChoice.wells[0]

wellOfChoiceForecastData = well.get_forecast_data(PID = petronId)

## Close the session