Example #1
0
def login():

    if request.method == "POST":

        user = request.form['uname']
        passwd = request.form['psw']

        globalV.vs = valispace.API(url='iclrocketry.valispace.com',
                                   username=user,
                                   password=passwd)
        #valispaceObj = valispace.API(url='iclrocketry.valispace.com', username = user, password = passwd)

        return redirect('/success')
    return render_template("login.html")
Example #2
0
    def __init__(self, url, username, password, project_name):
        self.valispace = valispace
        self.username = username
        self.password = password
        self.url = url
        self.project_name = project_name
        self.valispace_api = valispace.API(url=url,
                                           username=self.username,
                                           password=self.password)

        self.project_comps = self.valispace_api.get_component_list(
            project_name=project_name)
        self.project_vars = self.valispace_api.get_vali_list(
            project_name=project_name)
Example #3
0

#----------- Functions ---------------#
def findidxDict(dictList, namekey):
    dictidx = []
    for idx in range(0, len(dictList)):
        if dictList[idx]['name'] == namekey:
            dictidx = idx
            break
    if dictidx == []:
        print("Does not Exist")
    return dictidx


valispace = valispace.API(url='https://app.valispace.com',
                          username='******',
                          password=keyring.get_password(
                              "valispace", "kuldeep"))

uiApplication = GetActiveObject('STK11.Application')
root = uiApplication.Personality2

scenario1 = root.CurrentScenario
scenario2 = scenario1.QueryInterface(STKObjects.IAgScenario)

root.Rewind()

# Fetch from Valispace
### Enter PROJECT NAME here ###
project_Name = 'ValiSAT_STK_GEO'

# Fetch project JSON object for above project name
import valispace
import csv, json

deployment = input("Deployment Name:")
username = input("Username: "******"Password: "******"https://" + deployment + ".valispace.com/",
                          username=username,
                          password=password)

## Add File path e.g. - Make sure you use /, not \, to divide folders
csvFilePath = ".../file.csv"
# Id of the specification the requirements should added to
specification_ID = 0


def import_req(csvFilePath, specification_ID):
    with open(csvFilePath, encoding="utf8") as csvFile:
        csvReader = csv.DictReader(csvFile)
        for rows in csvReader:
            req = {
                "specification": specification_ID,
                "identifier": rows['ID'],
                "title": rows['Name'],
                "text": rows['Description']
            }
            requirementPosted = valispace.post('requirements/', req)


import_req(csvFilePath, specification_ID)
Example #5
0
import streamlit as st
import streamlit.components.v1 as components  #For components.HTML
import valispace
import time
import pandas as pd

st.beta_set_page_config(
    page_title="ValiRocket",
    page_icon="https://iclrocketry.valispace.com/assets/img/logo/icon.png")
"""
# ValiRocket.
Imperial College Rocketry
"""
st.sidebar.write("Designed by ya boi Raihaan")

user = st.sidebar.text_input("Username", '')
passwd = st.sidebar.text_input("Password", type="password")
if passwd:
    with st.spinner("Logging in..."):
        try:
            vs = valispace.API(url='iclrocketry.valispace.com',
                               username=user,
                               password=passwd)
            st.success("Success!")
        except:
            st.error('Invalid credentials')

option = st.selectbox('What u wanna do m8?', ('Track changes', 'First push'))

st.write("You picked " + option)
Example #6
0
wvm = "w"
wvmid = "d6cf21a6b4d1850415a83496"

parts_data = data.get_parts_wmv(did=did,
                                wvm=wvm,
                                wvmid=wvmid)

name_list = []
for element in parts_data:
    name_list.append(element["name"])

print(name_list)


# Put to Valispace
valispace_api = valispace.API(url=url, username=username, password=password)
project_comps = valispace_api.get_component_list(
    project_name=project_name)

for v in project_comps:
    if v["name"] == "Motorcycle":
        print(v)
    motorcycle = v

    if v["name"] == "Light":
        print(v)


# -- put component
valispace_api.post_data(type='component', data="""{
                                                    "name": "Light",
Example #7
0
def login():
    return valispace.API(url='https://example.valispace.com/',
                         username='******',
                         password='******')
Example #8
0
#!/usr/bin/env python2

# TEST COMAND EXAMPLES WITH THE SATURN V PROJECT

# Before:
# Saturn V project id should be = 1 (change in example if it isn't)
# In CommandModule.Mass mark impact to LaunchEscapeSystem.Mass
# Tag CommandModule component and CommandModule.Mass with a tag named "test".
# Tag id should be = 1 (change in example if it isn't)

import valispace

vali = valispace.API()

print("\n--- GET VALI ---")
a = vali.get_vali(id=3)
print("id=3: \n" + str(a))
b = vali.get_vali_by_name(vali_name='CommandModule.Mass',
                          project_name='Rocket__SaturnV')
print("\nname='CommandModule.Mass' \n" + str(b))

print("\n\n--- GET FILTERED VALI LISTS ---")
c = vali.get_vali_list(workspace_id=1)
print("workspace_id=1: \n" + str(c))
d = vali.get_vali_list(workspace_name='Default Workspace')
print("\nworkspace_name='Default Workspace' \n" + str(d))
e = vali.get_vali_list(project_id=2)
print("\nproject_id=2: \n" + str(e))
f = vali.get_vali_list(project_name='Saturn_V')
print("\nproject_name='Saturn_V' \n" + str(f))
g = vali.get_vali_list(parent_id=3)
@app.route('/login', methods=['GET', 'POST'])
def login():
    if request.method == 'POST':
        return do_the_login()
    else:
        return show_the_login_form()
    
if __name__ == "__main__":
    port = int(os.environ.get("PORT", 5000))
    app.run(host='0.0.0.0', port=port)


# Connecting to the Valispace API
passwd = keyring.get_password('valispace','raihaan.usman19')
valispace = valispace.API(url='iclrocketry.valispace.com', username='******', password=passwd)


# # Select project
# project_name = 'SYSTEMS_TEST'

# project = {'name':project_name, 'id':valispace.get_project_by_name(name=project_name)[0]['id']}
# print("\nCurrently working on the",project['name'],"project (ID: "+str(project['id'])+")")


# # Handling the RKT model
# tree = ET.parse('test.rkt')
# root = tree.getroot()
# for lvl3 in root.findall("./"):
#     print(lvl3.tag)
Example #10
0
import time

#from win32api import GetSystemMetrics
from comtypes.client import CreateObject
#from comtypes.gen import STKUtil
from comtypes.gen import STKObjects

### -------------- Fetch Project and Data from Valispace ----------------- ##
### Enter PROJECT NAME here ###
project_Name = 'ValiSAT_STK'

user_name = 'kuldeep'
pass_word = keyring.get_password("valispace", "kuldeep")
## Connect to Valispace
valispace = valispace.API(url='https://app.valispace.com',
                          username='******',
                          password=pass_word)

# Fetch project JSON object for above project name
dict_project = valispace.get_project_by_name(name=project_Name)
projectID = dict_project[0]['id']

## Get GroundStation JSON object - Looks for a parent component 'GroundStations' which comprises of all individual GS as children
GS_dict = valispace.get_component_by_name(unique_name='GroundStations',
                                          project_name=project_Name)
#Get Component IDs for all children- individual GS
GS_compIDs = GS_dict[0]['children']
temp = {}

#Construct new Dictionary with GS variables necessary to pass to STK
GS_dict_STK = []