def buttonevent_preview(self, event):
		print('debug: Preview...')
		self.options_generation()
		#system_preview = copy.deepcopy(self.system)
		tree = ET.parse(self.options.config_file)
		root = tree.getroot()
		system_preview = chris.System(root.attrib['name'], [])
		allnode, alllb, allimage = get_nodes.get_nodes(self.options.key_file, get_keys.get_keys(True, self.options.key_file))
		system_preview.reconfig(root, False, allnode, self.options, alllb)
		#system_preview.name = 'temp'
		if not reconfig_single.reconfig_single(self.options, system_preview, self.allnode, self.alllb, modifyxml = False):
			print('Error; reconfig_single()')
			return
		tree = ET.parse('configuration.preview.xml')
		root = tree.getroot()
		#print('debug: finish parsing')
		system_preview = chris.System(root.attrib['name'], [])
		if not system_preview.reconfig(root, False, allnode, self.options, alllb, preview = True):
			print('Error: Preview Failed')
			return
		#	#print('Warning: This faile might already cause some changes to the system')
		#	exit()
		print('hi')
		self.tree_generation(self.m_treeCtrl2, system_preview = system_preview)
		self.m_treeCtrl2.ExpandAll()
		self.m_staticText11.SetLabel("After Reconfig (Estimated)")
		self.m_treeCtrl2.Update()
    elif options.scale_direct != "a" and options.scale_direct != "d":
        print("-d option should be 'a' for adding, or 'd' for decreasing")
        exit()
print("debug: options:")
print(options)
# print('debug: mode= ' + mode)


# ----- check key file -----
providers = []

# key file not existed
if not os.path.exists(options.key_file):
    print("debug: key file not existed")
    if options.gui == "y":
        get_keys.get_keys(False, options.key_file)
    else:
        print("Error: Please edit or specify the key file to provide keys")
    exit()

# key file existed
providers = get_keys.get_keys(True, options.key_file)
if providers == None:
    print("Error: No valid provider")
    exit()

# ..... key file existed .....

# ----- get nodes -----
allnode, alllb, allimage = get_nodes.get_nodes(options.key_file, providers)
if len(allnode) < 1:
Example #3
0
from dropbox import client, rest, session
from get_keys import get_keys
APP_KEY = 'ey24mzrpiyv5rzf'
APP_SECRET = 'd0kh09zn6hv58hg'
ACCESS_TYPE = 'app_folder'

sess = session.DropboxSession(APP_KEY, APP_SECRET, ACCESS_TYPE)
keys = get_keys()
sess.set_token(keys[0], keys[1])
print keys[0], keys[1]

client = client.DropboxClient(sess)
file_name = "file.txt"
response = client.put_file("/" + file_name, open(file_name))
print "uploaded:", response
Example #4
0
from binance.client import Client
import os
import sys
functionsLocation = os.path.join(os.getcwd(), 'Something_special')
sys.path.insert(0, functionsLocation)

#GETS KEYS FROM SECRET FOLDER: 'Something_special'. WRITE IN EXACTLY THIS FOLDER NAME(!!) 
#This folder is ignored by github so that we dont go tammy on this shit i.e. -50k
from get_keys import get_keys
api_key, api_secret = get_keys()

client = Client(api_key, api_secret)

# # get market depth
depth = client.get_order_book(symbol='BNBBTC')

# place a test market buy order, to place an actual order use the create_order function
order = client.create_test_order(
    symbol='BNBBTC',
    side=Client.SIDE_BUY,
    type=Client.ORDER_TYPE_MARKET,
    quantity=100)

# # get all symbol prices
prices = client.get_all_tickers()
# withdraw 100 ETH
# check docs for assumptions around withdrawals
from binance.exceptions import BinanceAPIException, BinanceWithdrawException
try:
    result = client.withdraw(
        asset='B',