Python API for PetroVisor platform.
Project description
PetroVisor API
Python interface to PetroVisor REST API.
Install
Install petrovisor
package from pip
pip install petrovisor
or from the source
python -m pip install .
Make sure that pip
, setuptools
and build
are up to date
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade build
Uninstall
Uninstall petrovisor
package
python -m pip uninstall petrovisor
Dependencies
REST API interface is implemented using requests
Other dependencies include
Documentation
Details of the API endpoints and data models can be found in the Swagger links below, which are always up-to-date.
PetroVisor Web API (US1)
PetroVisor Web API (EU1)
Other documentation can be found by the following link.
How to use
Authorization
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 = 'Workspace Name'
# url
discovery_url = r'https://identity.us1.petrovisor.com' # US
# discovery_url = r'https://identity.eu1.petrovisor.com' # EU (alternative)
username
and password
credentials can be entered either by using the login dialog
pv_api = pv.PetroVisor(workspace = workspace,
discovery_url = discovery_url)
or by specifying username
and password
arguments directly
pv_api = pv.PetroVisor(workspace = workspace,
discovery_url = discovery_url,
username = username,
password = password)
Examples: Get, Post, Put, Delete requests
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.
Put request
name = 'Well'
pv_api.put(f'Entities/{name}', data = {
'Name': name,
'EntityTypeName': 'Well',
'Alias': 'Well Alias',
'IsOpportunity': False,
})
Post request
old_name = 'Well'
new_name = 'New Well'
pv_api.post(f'Entities/Rename', query = {
'OldName': old_name,
'NewName': new_name,
})
Get request
name = 'New Well'
pv_api.get(f'Entities/{name}')
Delete request
name = 'New Well'
pv_api.delete(f'Entities/{name}')
More examples can be found in the examples
directory of the repository.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file petrovisor-0.1.9.tar.gz
.
File metadata
- Download URL: petrovisor-0.1.9.tar.gz
- Upload date:
- Size: 68.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df710c2b006ba4b561f2ee776d631c1dd605e09f062d9782a2153904726aeb3a |
|
MD5 | 09b16a3b1cd95ff2c9d164185052f9b2 |
|
BLAKE2b-256 | 9c7d30928e315d05766fb437026f178a1ba55eb95c2da60e92422a4cea44f2c5 |
File details
Details for the file petrovisor-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: petrovisor-0.1.9-py3-none-any.whl
- Upload date:
- Size: 78.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2901a85b708ca203d1160ddf0b2a99eb7e37c87a9618fca64e0a1904815e8177 |
|
MD5 | 6ec36d8907dfc11c319a6782e3dee7ab |
|
BLAKE2b-256 | a1fdc091b810d2caff920574e78b8fdcf2c46b0a9b950f65e86e843cbbfb9300 |