Exporting images as.png files (Quick image beta)
The process is otherwise similar to Exporting images as .png files , but the related
python script image-export.py is as follows:
#!/usr/bin/python
# -*- coding: utf-8 -*-
from requests_futures.sessions import FuturesSession
import datetime
APP_URL = "your_url_here"
IMAGE_EXPORT_LOC = "/focus-webapp/api/v2/image-export/png"
OUTPUT_FILE_PATH = "yourpath_and_nameofoutputimageinpng_here"
USERNAME = "username_here"
PASSWORD = "password_here"
TIME = datetime.datetime.utcnow().isoformat()
VIEW_NAME = "view_name_here"
VIEW_USER = 'view_owner_here'
ADD_LEGEND = "1"
def main():
session = FuturesSession()
req_params = {
"username": USERNAME,
"password": PASSWORD,
"time": TIME,
"savedViewName": VIEW_NAME,
"savedViewUser": VIEW_USER,
'hasLegend': ADD_LEGEND
}
future_one = session.post(APP_URL + IMAGE_EXPORT_LOC, params=req_params, verify=False) # wait for the request to complete, if it hasn't already
res = future_one.result()
print('{0} response status: {1}'.format(TIME, res.status_code))
if res.status_code == 200:
with open(OUTPUT_FILE_PATH, 'wb') as f:
f.write(res.content)
if __name__ == '__main__':
main()
| Parameter | Description | ||
|---|---|---|---|
| username | IRIS Focus user name
|
||
| password | IRIS Focus password for the user | ||
| time |
Time, in ISO-8601 format:
Example: 2024-06-18T16:25:23.000Z |
||
| savedViewName | The name of the saved view | ||
| saveViewUser | (Optional) The IRIS Focus user who owns the saved view. Used if you configure a specific user for exporting images (recommended). | ||
| hasLegend | Add legend (0/1) |
