Below is an example script to get a GroveStreams session token and use that token to download an organization backup file using the GroveStreams HTTP restful API.

It is written using Python 3.7.

# GroveStreams.com Python 3.7 Feed Example
# Demonstrates getting a session token and backing up an organization to a local file
 
 
# License:
# Copyright 2019 GroveStreams LLC.
# Licensed under the Apache License, Version 2.0 (the "License";
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import requests
import datetime;
 
if __name__ == '__main__':
 
    #CHANGE THESE!!!!!!
    userId = "brucelee@acme.com"
    userPwd = "wingchung"
    org = 'af5da88b-1487-3873-a7c4-5ea69d867f3a'     
    backupFile = "/home/gs/gs_backup_" + datetime.datetime.now().strftime('%Y-%m-%d %H:%M') + ".zip"  #This is a linux directory. Change it to a Windows directory if that's what you're using
    
 
    try:    
        # Login and get a use session token
        url = "https://grovestreams.com/api/login"
        data = {
            "email": userId,
            "password" : userPwd
        }
 
        response = requests.post(
            url,
            json=data
        )
        if response.status_code != 200 and response.status_code != 201:
            try:
                if (response.reason != None):
                    print('HTTP Failure Reason: ' + response.reason + ' body: ' + response.read().decode(encoding='UTF-8'))
                else:
                    print('HTTP Failure Body: ' + response.read().decode(encoding='UTF-8'))
            except Exception:
                print('HTTP Failure Status: %d' % (response.status_code))
 
 
        json_response = response.json()
        session = json_response["sessionUid"]
 
        #Download the Backup File
        url = "https://grovestreams.com/api/organization/backup?org=" + org + "&time=&exportAll=true&compDir=&contentDir=&session=" + session
        chunk_size = 100000
 
        r = requests.get(url, stream=True)
        with open(backupFile, 'wb') as fd:
            for chunk in r.iter_content(chunk_size):
                fd.write(chunk)
 
        if response.status_code != 200 and response.status_code != 201:
            try:
                if (response.reason != None):
                    print('HTTP Failure Reason: ' + response.reason + ' body: ' + response.read().decode(encoding='UTF-8'))
                else:
                    print('HTTP Failure Body: ' + response.read().decode(encoding='UTF-8'))
            except Exception:
                print('HTTP Failure Status: %d' % (response.status_code))
 
    except Exception as e:
        print('HTTP Failure: ' + str(e))
 
 
    # quit
    exit(0)