Sparkflows Logo
latest
  • Architecture & Deployment
  • Installation
  • Configuration
  • Authentication
  • Security
  • Operating Guide
  • Quickstart Guide
  • User Guide
  • Analytical Apps User Guide
  • Machine Learning User Guide
  • Time Series Analysis
  • Tutorials
  • Troubleshooting
  • FAQ
  • Administration Guide
  • Databricks Guide
  • AWS Guide
  • AZURE Guide
  • Load Balancer
  • Superset
  • Python Integration
  • Performance Tuning
  • Developer Guide
  • Processors
  • Release Notes
  • REST API Authentication
    • Acquire Session Cookie Using CURL
    • Acquire Session Cookie in Python
      • Get List of Processors
    • Acquire Token Using CURL
    • Acquire Token using Postman and Grant Type - Password
    • Acquire token using Postman - Authorization code
    • Acquire Token in Python - Grant Type Password
  • REST API Examples using Python
  • REST API Examples using Java
  • REST API Examples using curl
  • Third Party Acknowledgements
Sparkflows
  • Docs »
  • REST API Authentication »
  • Acquire Session Cookie in Python
  • Edit on GitHub

Acquire Session Cookie in Python¶

Fire Insights REST API’s can be accessed with Python. Session Cookie can be acquired using username and password and used in the subsequent calls.

Get List of Processors¶

The below code in Python logs in the user and acquires the session cookie via the Fire Insights REST API.

It then gets the list of Processors in Fire Insights using the REST API and prints them.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python

# This python script logs into an instance of sparkflows, and then gets the list of Processors/Operators supported

# -*- coding: utf-8 -*-
import json
import requests

payload = {'username':'admin', 'password':'admin'}

# login url
urllogin = 'http://localhost:8080/login'

# get list of processors url
urlprocessors = 'http://localhost:8080/nodeList'

with requests.session() as s:

  # log into sparkflows
  r = s.post(urllogin, data=payload)

  # get list of processors
  resp = s.get(urlprocessors)

  parsed_resp = json.loads(resp.text)

  for i in parsed_resp:
    print (i['name'])
Next Previous

© Copyright 2020, Sparkflows Inc. Revision b27cc99c.

Built with Sphinx using a theme provided by Read the Docs.