Python interface to PetroVisor REST API.
For comprehensive guides, tutorials, and API reference, please visit our official documentation site.
The complete PetroVisor REST API specification, including all available endpoints and data models, is accessible through our Swagger documentation:
petrovisor
can be installed using pip
or uv
from PyPI, GitHub, or directly from the source.
- Python 3.7 or higher, Python 3.12 (Recommended)
- pip (Python package installer) or uv (extremely fast Python package and project manager, written in Rust)
pip install petrovisor
or
uv pip install petrovisor
pip install git+https://github.com/Datagration/petrovisor-python-api.git
or
uv pip install git+https://github.com/Datagration/petrovisor-python-api.git
- Clone the repository
git clone https://github.com/Datagration/petrovisor-python-api.git
cd petrovisor-python-api
- Install the package
pip install .
or
uv pip install .
You can verify that petrovisor is installed correctly by importing it in Python:
import petrovisor as pv
print(pv.__version__)
For contributors, you can install development dependencies with:
pip install -e "[.dev]"
or
uv pip install -e "[.dev]"
Note that package installation dependencies are defined in pyproject.toml
, while the requirements.txt
file includes additional packages needed for development, testing and documentation.
This package uses Hatchling as its build system. Hatchling is a modern, extensible Python build backend that follows the latest packaging standards (PEP 517/518).
Uninstall petrovisor
package
pip uninstall petrovisor
or
uv pip uninstall petrovisor
REST API interface is implemented using requests
Other dependencies include
If one uses Jupyter notebook or running Python script from console for authorization the user required to specify the workspace
and discovery_url
.
workspace = 'Workspace Name'
# url for authentification (US or EU)
discovery_url = r'https://identity.us1.petrovisor.com' # US
discovery_url = r'https://identity.eu1.petrovisor.com' # EU
username
and password
credentials can be entered either by using the login dialog
api = pv.PetroVisor(workspace = workspace,
discovery_url = discovery_url)
or by specifying username
and password
arguments directly
api = pv.PetroVisor(workspace = workspace,
discovery_url = discovery_url,
username = username,
password = password)
Basic API requests such as get
, post
, put
, delete
consist of main URL/route part,
as well as an optional data
and query
string arguments.
data
and query
arguments can presented by the built-in Python dictionary.
name = 'Well'
api.put(f'Entities/{name}', data = {
'Name': name,
'EntityTypeName': 'Well',
'Alias': 'Well Alias',
'IsOpportunity': False,
})
old_name = 'Well'
new_name = 'New Well'
api.post(f'Entities/Rename', query = {
'OldName': old_name,
'NewName': new_name,
})
name = 'New Well'
api.get(f'Entities/{name}')
name = 'New Well'
api.delete(f'Entities/{name}')
More examples can be found in the examples
directory of the repository.