Ejemplo n.º 1
0
    def login(self):
        username_text = self.username_edit.text()
        password_text = self.password_edit.text()
        mydb = db.mydb
        mycursor = db.mycursor

        mycursor.execute("SELECT username, pass FROM users WHERE username = %s AND pass = %s", (username_text, password_text))
        usercheck = mycursor.fetchone()
        if(usercheck != None and usercheck[0] == username_text and usercheck[1] == password_text):
            print("Login Success!")

            sql = "SELECT users.SSN FROM users WHERE users.Username = %s"
            mycursor.execute(sql, [username_text])
            myresult = mycursor.fetchone()
            UserInfo.ssn = myresult[0]

            UserInfo.retrieveUserInfo()

            self.MemeWindow = QtWidgets.QMainWindow()
            self.ui = MemeWindow()
            self.ui.setupUi(self.MemeWindow)
            self.CurrentWindow.hide()
            self.MemeWindow.show()
        else:
            print("Login Failed!")
Ejemplo n.º 2
0
def index(request, route):
    close_old_connections()
    if route == 'wxegisterSign':
        callBackDict = UserInfo.wxegisterSign(request)
    elif route == 'wxgetCarList':
        callBackDict = Car.wxgetCarList(request)
    elif route == 'wxAddCar':
        callBackDict = Car.wxAddCar(request)
    elif route == 'wxEditCar':
        callBackDict = Car.wxEditCar(request)
    elif route == 'getCarInfo':
        callBackDict = CheckGetInfo.getCarInfo(request)
    elif route == 'getGetTaskInfo':
        callBackDict = CheckGetInfo.getGetTaskInfo(request)
    elif route == 'getDoTaskInfo':
        callBackDict = CheckGetInfo.getDoTaskInfo(request)
    elif route == 'adminGetAllUsers':
        callBackDict = UserInfo.adminGetAllUsers(request)
    elif route == 'perfectUserInfo':
        callBackDict = UserInfo.perfectUserInfo(request)
    elif route == 'webSign':
        callBackDict = UserInfo.webSign(request)
    elif route == 'adminisEnabledUser':
        callBackDict = UserInfo.adminisEnabledUser(request)
    else:
        return HttpResponse("no found !!!")
    if callBackDict == None:
        callBackDict = {"code": -1, 'msg': '系统异常'}
    return HttpResponse(json.dumps(callBackDict))
Ejemplo n.º 3
0
 def sell_stock(self):
     value = self.df["High"].tail()[-1]
     num = int(self.sell_edit.text())
     if num < 1:
         print("User must enter a positive integer.")
     elif num > UserInfo.volume:
         print("User does not have " + str(num) + " stocks to sell.")
     else:
         print("User sold " + str(num) + " shares!")
         print("Added " + str(value * num) + " to the User's balance!")
         UserInfo.volume -= num
         # update number of volume
         db.mycursor.execute("UPDATE portfolio SET volume = %s WHERE ssn = %s AND stockid = %s", (UserInfo.volume, UserInfo.ssn, self.stock_name))
         # find current balance
         db.mycursor.execute("SELECT balance FROM users WHERE ssn = %s", [UserInfo.ssn])
         results = db.mycursor.fetchone()
         new_balance = results[0] + (value * num)
         print("New balance is " + str(new_balance) + ".")
         # update new balance
         db.mycursor.execute("UPDATE users SET balance = %s WHERE ssn = %s", (float(new_balance), UserInfo.ssn))
         db.mycursor.execute("INSERT INTO trades VALUES (%s, NULL, %s, %s, NOW(), %s, %s)", (UserInfo.ssn, UserInfo.selectedStock, (-1*num), float(value), float((value*num))))
         db.mydb.commit()
         self.stock_name_label_update()
         UserInfo.retrieveUserInfo()
         UserInfo.retrieveVolume()
         self.update_balance()
Ejemplo n.º 4
0
 def post(self, *args, **kwargs):
     userName = self.get_argument('userName', '')
     phone = self.get_argument('phone', '')
     address = self.get_argument('address', '')
     user = UserInfo.User()
     user.userName = userName
     user.phone = phone
     user.address = address
     userDb = UserInfo.operateDb()
     userDb.operate(user)
     baseResponse = BaseResponse()
     baseResponse.code = "000001"
     baseResponse.desc = "successfully"
     json_str = json.dumps(baseResponse, cls=AllGoodsEncoder)
     self.write(json_str)
Ejemplo n.º 5
0
 def stock_click(self):
     try:
         data.DataReader(self.stock_edit.text(), 'yahoo')
     except:
         self.high_label.setText("Enter a legit company stock ID >.<")
     else:
         self.StockWindow = QtWidgets.QMainWindow()
         UserInfo.selectedStock = self.stock_edit.text()
         UserInfo.retrieveVolume()
         self.ui = StockWindow(self.stock_edit.text())
         self.ui.connectWindows(self.CurrentWindow)
         self.ui.setupUi(self.StockWindow)
         self.StockWindow.show()
         self.CurrentWindow.hide()
         self.high_label.setText(
             "Hey cutie, please enter a legit stock ID :)  \n'AMZN' for Amazon \n'M' for Macys \n'AAPL' for Apple \n'AMD' for AMD \n'INTC' for Intel"
         )
Ejemplo n.º 6
0
def DataOn(data, socketAsync):
    if socketAsync.UserToken == None:
        socketAsync.UserToken = UserInfo(socketAsync, 1024 * 1024)
    stream = socketAsync.UserToken.Stream
    stream.Write(data)
    a, pdata = stream.Read()
    while a:
        PackIn(pdata, socketAsync.UserToken)
        a, pdata = stream.Read()
Ejemplo n.º 7
0
    def getEcsListDetailFromAllRegin(self):
        userInfo = UserInfo.UserInfo()

        sourthToken = userInfo.getUserTokenByProjectId(
            regionProjectId=userInfo.sourthProjectId)
        sourthPubHeader = self.getPubHeaderForToken(
            projectId=userInfo.sourthProjectId, token=sourthToken)
        sourthServers = self.getEcsListDetailFromRegin(
            ecsPubHeaderForToken=sourthPubHeader,
            regionEndPoint=self.cnSouth1EndPoint)

        northToken = userInfo.getUserTokenByProjectId(
            regionProjectId=userInfo.northProjectId)
        northPubHeader = self.getPubHeaderForToken(
            projectId=userInfo.northProjectId, token=northToken)
        northServers = self.getEcsListDetailFromRegin(
            ecsPubHeaderForToken=northPubHeader,
            regionEndPoint=self.cnNorth1EndPoint)

        eastToken = userInfo.getUserTokenByProjectId(
            regionProjectId=userInfo.eastProjectId)
        eastPubHeader = self.getPubHeaderForToken(
            projectId=userInfo.eastProjectId, token=eastToken)
        eastServers = self.getEcsListDetailFromRegin(
            ecsPubHeaderForToken=eastPubHeader,
            regionEndPoint=self.cnEast2EndPoint)

        northEastToken = userInfo.getUserTokenByProjectId(
            regionProjectId=userInfo.northeastProjectId)
        northEastPubHeader = self.getPubHeaderForToken(
            projectId=userInfo.northeastProjectId, token=northEastToken)
        northEastServers = self.getEcsListDetailFromRegin(
            ecsPubHeaderForToken=northEastPubHeader,
            regionEndPoint=self.cnNortheast1EndPoint)

        hongKangToken = userInfo.getUserTokenByProjectId(
            regionProjectId=userInfo.hangKongProjectId)
        hongKangPubHeader = self.getPubHeaderForToken(
            projectId=userInfo.hangKongProjectId, token=hongKangToken)
        hongkangServers = self.getEcsListDetailFromRegin(
            ecsPubHeaderForToken=hongKangPubHeader,
            regionEndPoint=self.apSouthEast1EndPoint)

        servers = []
        servers.append(sourthServers)
        servers.append(northServers)
        servers.append(eastServers)
        servers.append(northEastServers)
        servers.append(hongkangServers)

        HwcloudLog().debug(
            "get ECS List Detial Data From all Region Message is")
        HwcloudLog().debug(servers)
        HwcloudLog().info("获取ECS List 详情页面全region信息。")

        return servers
Ejemplo n.º 8
0
def main():
    conf = Config()
    ### add args
    conf.addFromArg(sys.argv[1:])
    user = conf.getConf('user', 'User name')
    ### set user info
    info = UserInfo()
    info.initUserInfo(user)
    ### run project
    #####projname = conf.getConf('appname', 'The app name')
    #conf.loadConfigFromFile(os.path.dirname(__file__)+'/conf/'+projname+'.conf')
    projMod = __import__('projects.jrdcommon', globals(), locals(), '*')
    proj = projMod.project()

    try:
        print 'START!'
        proj.run()
    finally:
        proj.cleanup()
        print 'finish!'
Ejemplo n.º 9
0
def conn_radosgw(username):
    cmd_hook = UserInfo.paramiko_cmd()
    user_info = cmd_hook.user_info_get(username)

    access_key = user_info.s3_access_key
    secret_key = user_info.s3_secret_key
    radosgw_port = user_info.radosgw_port
    radosgw_host = user_info.radosgw_host
    connection_object=s3_api.CONNECTION(access_key,secret_key,radosgw_host,radosgw_port)


    return connection_object
Ejemplo n.º 10
0
def main():
    conf = Config()
    conf.addFromArg(sys.argv[1:])

    user = conf.getConf('user', 'User name')

    env = UserInfo()
    env.initUserInfo(user)

    conf.loadConfigFromFile(os.path.dirname(__file__) + '/conf/mml.conf')

    # if projname != '__init__' and os.path.isfile(os.path.dirname(__file__)+"/projects/"+projname+".py"):
    #     projMod = __import__('projects.'+projname, globals(), locals(), '*')
    # else:
    #     from projects import BaseProject as projMod

    # proj = projMod.project(conf)
    try:
        run(conf)
    except SystemExit:
        raise
Ejemplo n.º 11
0
def main():
    conf = Config();
    conf.addFromArg(sys.argv[1:])

    user = conf.getConf('user', 'User name')

    env = UserInfo()
    env.initUserInfo(user)

    conf.loadConfigFromFile(os.path.dirname(__file__)+'/conf/mml.conf')

    # if projname != '__init__' and os.path.isfile(os.path.dirname(__file__)+"/projects/"+projname+".py"):
    #     projMod = __import__('projects.'+projname, globals(), locals(), '*')
    # else: 
    #     from projects import BaseProject as projMod

    # proj = projMod.project(conf)
    try:
        run(conf)
    except SystemExit:
        raise
Ejemplo n.º 12
0
def main():
	conf = Config();
	### add args
	conf.addFromArg(sys.argv[1:])
	print "test for auto test mail ....."
	print sys.argv[1:]
	user = conf.getConf('user', 'User name')
	### set user info
	info = UserInfo()
	info.initUserInfo(user)
	### run project 
	projname = conf.getConf('project', 'Project name')

	projMod = __import__('projects.'+projname, globals(), locals(), '*')
	proj = projMod.project()

	try:
		print 'START!'
		proj.run()
	finally:
		proj.cleanup()
		print 'finish!'
Ejemplo n.º 13
0
def uiDisplay():
    #视图层与逻辑层分离
    while True:
        menuList = [
            '线路信息管理', '游客信息管理', '排团信息管理', '导游信息管理', '用户管理/备份恢复', '退出程序'
        ]
        print("欢迎使用旅行社信息管理系统")
        count = 1
        for w in menuList:
            print((str)(count) + ":" + w)
            count = count + 1
        choose = eval(input("请输入你想要的功能"))
        if choose == 1:
            DestInfo.main()
        elif choose == 2:
            TouristInfo.main()
        elif choose == 3:
            ArragementInfo.main()
        elif choose == 4:
            TeamInfo.main()
        elif choose == 5:
            UserInfo.main()
        elif choose == 6:
            exit()
Ejemplo n.º 14
0
 def buy_stock(self):
     value = self.df["High"].tail()[-1]
     num = int(self.buy_edit.text())
     db.mycursor.execute("SELECT balance FROM users WHERE ssn = %s", [UserInfo.ssn])
     results = db.mycursor.fetchone()
     curr_balance = results[0]
     if num < 1:
         print("User must enter a positive integer.")
     elif num * value > curr_balance:
         print("User does not have " + str(num * value) + " dollars to buy " + str(num) + " stocks.")
     else:
         print("User bought " + str(num) + " shares!")
         print("Subtracted " + str(value * num) + " to the User's balance!")
         UserInfo.volume += num
         db.mycursor.execute("UPDATE portfolio SET volume = %s WHERE ssn = %s AND stockid = %s", (UserInfo.volume, UserInfo.ssn, self.stock_name))
         new_balance = curr_balance - (value * num)
         print("New balance is " + str(new_balance) + ".")
         db.mycursor.execute("UPDATE users SET balance = %s WHERE ssn = %s", (float(new_balance), UserInfo.ssn))
         #db.mycursor.execute("INSERT INTO trades VALUES (%s, %s, %s, %s, NOW(), %s, %s)", (UserInfo.ssn, test, UserInfo.selectedStock, num, float(value), float((value*num*-1))))
         db.mydb.commit()
         self.stock_name_label_update()
         UserInfo.retrieveUserInfo()
         UserInfo.retrieveVolume()
         self.update_balance()
Ejemplo n.º 15
0
    def initUi(self):
        self.heading = QLabel('Hello ' +
                              userInfo.UserInfo().getAccount(self.username))
        self.heading.setAlignment(QtCore.Qt.AlignCenter)
        self.sort = QComboBox()
        self.sort.addItems(['Default', 'Status', 'Priority'])
        self.apply = QPushButton('Apply')
        self.apply.clicked.connect(self.applySort)

        self.title = QLabel('Events')
        self.title.setFont(QFont('Arial', 16))
        self.title.setAlignment(QtCore.Qt.AlignCenter)
        self.data = []
        if (path.exists(self.path)):
            with open(self.path, 'r') as rf:
                for line in rf:
                    self.data.append(line.split(";"))

        self.dataPane = QGridLayout()
        self.dataPane.setAlignment(QtCore.Qt.AlignHCenter)
        self.dataPane.setHorizontalSpacing(30)
        for i in range(len(self.data)):
            self.dataPane.addWidget(QLabel(self.data[i][0]))

        self.create = QPushButton('Create Event')
        self.create.clicked.connect(self.createEvent)
        self.delete = QPushButton('Delete Event')

        self.topHbox = QHBoxLayout()
        self.topHbox.addWidget(self.sort)
        self.topHbox.addWidget(self.apply)
        self.topHbox.setSpacing(30)

        self.bottomHbox = QHBoxLayout()
        self.bottomHbox.addWidget(self.create)
        self.bottomHbox.addWidget(self.delete)
        self.bottomHbox.setSpacing(10)

        self.vbox = QVBoxLayout()
        self.vbox.addWidget(self.heading)
        self.vbox.addLayout(self.topHbox)
        self.vbox.addWidget(self.title)
        self.vbox.addLayout(self.dataPane)
        self.vbox.addLayout(self.bottomHbox)
        self.vbox.setAlignment(QtCore.Qt.AlignCenter)
        self.vbox.setSpacing(10)

        self.setLayout(self.vbox)
Ejemplo n.º 16
0
    def __init__(self,obj):
        self.UserName = ""
        self.UserId = 0
        self.UserUrl = ""
        self.ProductName = ""
        self.ProductPrice = 0

        user_obj = UserInfo.UserInformation()

        if user_obj.setUserInfo(obj):
            self.UserName, self.UserId, self.UserUrl, self.ProductName, self.ProductPrice = user_obj.getUserInfo()
            #print(self.UserName, self.UserUrl, self.UserId, self.ProductName, self.ProductPrice)
            self.putInfoInExcel()

        else:
            #print("Data can't be entered")
            self.success = False
Ejemplo n.º 17
0
 def get_comment_list_by_news_id(cls, uid, token, news_id):
     comment_list = []
     comments = NewsComment.objects.filter(news_id=news_id)
     if comments is not None:
         for comment in comments:
             comment_dict = {}
             comment_dict['cid'] = comment.id
             if comment.uid == uid:
                 comment_dict['uid'] = comment.uid
             else:
                 comment_dict['uid'] = ''
             comment_dict['news_id'] = comment.news_id
             comment_dict['content'] = comment.content
             u = UserInfo.find_user_by_id(comment.uid, token)
             comment_dict['avatar'] = u.avatar
             comment_dict['time'] = comment.time
             comment_dict['user_name'] = u.name
             comment_list.append(comment_dict)
     return comment_list
Ejemplo n.º 18
0
    def __init__(self):
        self.nLastParent = 0
        self.uiES = UserInfo()
        self.sDefAcct = ''
        self.nParentIDs = []
        self.nLastParent = 0
        self.print_on = True

        context = zmq.Context()
        pub = context.socket(zmq.PUB)
        port = pub.bind_to_random_port('tcp://*')

        self.pub = pub
        self.url = 'tcp://127.0.0.1:' + str(port)

        self.U_flag = False
        self.previously_connected = False

        # EXPERIMENTAL
        self.session_start_timestamp = datetime.datetime.now()
        self.cur_buying_power = 1000  # B, T orders reduce BP by same amt. BC, S orders do NOTHING to BP
Ejemplo n.º 19
0
    def getEcsListData(self):

        userinfo = UserInfo.UserInfo()
        domainToken = userinfo.getUserTokenByDomainName()
        ecsclass = EcsClass()
        getEcsDetailList = ecsclass.getEcsListDetailFromAllRegin()
        ecslist = []
        for regionEcsDetailList in getEcsDetailList:
            servers = regionEcsDetailList["servers"]
            for server in servers:
                ecsinfo = EcsClass()
                ecsinfo.ecsName = server["name"]
                ecsinfo.ecsCreated = server["created"]
                ecsinfo.ecsStatus = server["status"]
                ecsinfo.iamUserId = server["user_id"]
                ecsinfo.iamUserName = userinfo.selectUserIdForUserName(
                    iamUserId=ecsinfo.iamUserId, token=domainToken)

                ecslist.append(ecsinfo)

        return ecslist
Ejemplo n.º 20
0
#author:liuliu

import UserInfo #导入用户管理模块
import Connect #数据库连接模块
import mainui
       
if __name__ == "__main__":
       #程序入口
    Connect.main()
    a = UserInfo.login()
    if a == 1:
    
        mainui.uiDisplay()
    else:
        exit()
    

    
    
    
Ejemplo n.º 21
0
#
password = "******"
sum = 10

phone = '17828019328'
# password = "******"

if __name__ == '__main__':
    # 注册用户
    # addUser.AddUser(phone, email, password)

    # 获取登录token
    username = phone
    # access_token = 'Bearer' + loginToken.get_access_token_nuerpwd("17828019325", password)
    # access_token = 'Bearer' + loginToken.get_access_token_phone("17828019325")
    access_token = 'Bearer' + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsaWNlbnNlIjoibWFkZSBieSB0dGFzIiwiY29kZSI6MCwidXNlcl9uYW1lIjoiMTc4MjgwMTkzMjUkMyIsInNjb3BlIjpbInNlcnZlciJdLCJleHAiOjE1MzM3MDE3NzQsImF1dGhvcml0aWVzIjpbImZyb250dXNlciIsIlJPTEVfVVNFUiJdLCJqdGkiOiJhN2RjYjlmNC0yMzRmLTQwNWItOTcxMS1kMzM5YTZkMzE2NjAiLCJjbGllbnRfaWQiOiJwaWcifQ.rcVVhH5bw1CsJMQRidNjNsIHVxZdNTmRB-dc-6kYX-A'
    # 获取当前用户信息
    userInfo.userInfo(access_token)

    # 对APP、AppKey操作
    testApp.app_And_key(sum, access_token)
    '''#
    # for i in range(1):
    #     radAppId = numpy.random.randint(1, sum)
    #     appkey = selKey.seleceKeyById(129)
    #     if appkey != 1:
    #         keyDome.Token(appkey, access_token)'''

    # 查询时间凭证
    # selTime.selectTime(access_token)
Ejemplo n.º 22
0
 def __init__(self, loginid):
     self._loginid = loginid
     self._userinfo = UserInfo.UserInfo(loginid)
     self._found = False
Ejemplo n.º 23
0
from oauth2 import OAuth2

import UserInfo
import webbrowser
import requests
import json

if __name__ == "__main__":
    # Get uid and access_token
    uid, access_token = UserInfo.get_uid_access_token()

     # Show user info
    UserInfo.get_user_info(uid, access_token)


Ejemplo n.º 24
0
                return
            for i in range(len(args)):
                if '-' in args[i] and ('p' not in args[i]
                                       and 'u' not in args[i]):
                    print(
                        "[ERROR]: INPUT ERROR -- you entered invalid options!")
                    return

            status = users.checkUser(args[1], args[3])
            if status >= 0:
                self.current_user = args[1]
                print("< {0} >: Welcome! ".format(args[1]))
            elif status == -1:
                print(
                    "[ERROR]: LOG ERROR -- Account doesn't exists, Sign up firstly please!"
                )
            else:
                print("[ERROR]: LOG ERROR -- please enter right password!")
            return status


if __name__ == '__main__':
    users = UserInfo.Users()
    test = LogForm()
    while True:
        option = input("{0}:~$ ".format(test.current_user))
        if option == "quit" or option == "exit":
            print('Thanks for using. Bye~')
            break
        else:
            test.analyse(users, option)
Ejemplo n.º 25
0
def getUserInfo():
    username = input("Hello, Please enter your username: "******"Please enter your first name: ")
    lName = input("Please enter your last name: ")
    sudokuUser = UserInfo.User(fName, lName, username)
    return sudokuUser
Ejemplo n.º 26
0
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
import UserInfo
import subprocess

userinfo = UserInfo.UserInfo("userinfo.txt")
ui = ''


class Ui_MainWindow(object):
    def __init__(self, MainWindow):
        super().__init__()

        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(812, 509)
        self.centralWidget = QtWidgets.QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.label = QtWidgets.QLabel(self.centralWidget)
        self.label.setGeometry(QtCore.QRect(10, 10, 141, 31))
        font = QtGui.QFont()
        font.setFamily("Comic Sans MS")
Ejemplo n.º 27
0
        print('sqlite3 error:', e.args[0])

    connection.commit()
    connection.close()


if __name__ == '__main__':
    logger = PurchaseHistoryLogger()

    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.settimeout(1000)
        s.bind(('0.0.0.0', 8084))

        print('listening...')
        s.listen(1)
        while True:
            conn, addr = s.accept()
            with conn:
                try:
                    data = conn.recv(1024)
                    if not data:
                        break
                    print('data : {}, addr: {}'.format(data, addr))
                    decoded_user_info = UserInfo.ReceivedData(
                        **json.loads(data))
                    logger.log_purchase(decoded_user_info)
                    conn.send(b'ok')
                except:
                    pass
                conn.close()
Ejemplo n.º 28
0
 def preProcess(self, DATASET_PATH, perturb, directer, epsilon):
     # 1 从文件读取数据生成图
     # 2 生成各节点的出入邻点列表
     # 3 初始化出入度及排序
     # L=[]
     # attrNode = True
     # 从edge文件中读取数据创建图
     el = []
     nl = []
     if directer == '1':
         # 有向图
         G = nx.DiGraph()
         print "directedGraph "
         # 从文件读取数据生成有向图
         G = nx.read_adjlist(self.getFileFromSd(DATASET_PATH, "edge"),
                             create_using=nx.DiGraph())
         #unicode转string
         for i in G.nodes():
             nl.append(i.encode("utf-8"))
         for i in G.edges():
             el.append((i[0].encode("utf-8"), i[1].encode("utf-8")))
         num = 0
         for i in nl:
             self.ul.addUser(str(i), UserInfo(i, num))
             num += 1
         # 加入出入邻点列表
         for i in el:
             self.ul.getUser(str(i[0])).adjOutList.append(i[1])
             self.ul.getUser(str(i[1])).adjInList.append(i[0])
         del G
         gc.collect()
     else:
         # 无向图
         G = nx.Graph()
         print "unDirecedGraph"
         # 从文件读取数据生成无向图
         G = nx.read_adjlist(self.getFileFromSd(DATASET_PATH, "edge"))
         # unicode字符转string
         for i in G.nodes():
             nl.append(i.encode("utf-8"))
         for i in G.edges():
             el.append((i[0].encode("utf-8"), i[1].encode("utf-8")))
         # 加入userList
         num = 0
         for i in nl:
             self.ul.addUser(str(i), UserInfo(i, num))
             # L.append(UserInfo(i, num))
             num += 1
         # 加入出入邻点列表
         for i in el:
             self.ul.getUser(str(i[0])).adjOutList.append(i[1])
             self.ul.getUser(str(i[0])).adjInList.append(i[1])
             self.ul.getUser(str(i[1])).adjOutList.append(i[0])
             self.ul.getUser(str(i[1])).adjInList.append(i[0])
         del G
         gc.collect()
     del nl
     del el
     gc.collect()
     # print "memory ", sys.getsizeof(L)#/////////////////////////////////////////////////////////////////////////
     print "creating userlist finished "
     # 初始化出入度及排序
     self.sumLength = self.ul.initUserInfo(perturb, epsilon)
Ejemplo n.º 29
0
 def __init__(self, name):
     self.name = name
     self.username = "******"
     self.password = "******"
     self.userInfoOb = UserInfo.UserInfo("User")
Ejemplo n.º 30
0
    def packUserInfo(self, displayName, userName, password):

        userInfo = UserInfo(displayName, userName, password)
        return userInfo
Ejemplo n.º 31
0
        # print(message)
        messageEcs += message
    if len(groupOthers) > 0:
        message = "\n其他用户,有ECS资源" + str(len(groupOthers)) + "台,分别是:"
        for ecsC in groupOthers:
            # message += ecsC.ecsName + "(" + ecsC.ecsCreated + ")"
            message += ecsC.ecsName
            message += " , "
        # print(message)
        messageEcs += message

    messageEcs += "\n请各组长及时清理,避免浪费。"
    HwcloudLog().info(messageEcs)

    return messageEcs


if __name__ == '__main__':
    user = UserInfo.UserInfo()

    token = user.getUserTokenByProjectId(user.northProjectId)
    phones = getPhones()
    ecsClass = EcsInfo.EcsClass()
    ecsLists = ecsClass.getEcsListData()
    message = getMessage(ecsLists)

    sendMessage(projectId=user.northProjectId,
                phones=phones,
                token=token,
                message=message)
Ejemplo n.º 32
0
def userretailpins():
    USER_SECRET = "MTQzNTgwODo0OTUxODUwNTg5MzY2Njg0NzM6MnwxMzkwNjY5MzAzOjAtLTIwMTEzMGVhMzYyYzM1NTEyZTA1NjJlNGZiYTJjMTBiN2RhMmEwZjU="
    user_id = '495185058936668473'
    results = UserInfo.getUserRetailPins(USER_SECRET,user_id)
    return Response(json.dumps(results),mimetype='application/json',)