コード例 #1
0
    def cmdloop(self):

        while not self.flag:
            try:
                sys.stdout.write(self.prompt)
                sys.stdout.flush()

                # Wait for input from stdin & socket
                inputready, outputready,exceptrdy = select.select([0, self.sock], [],[])
                
                for i in inputready:
                    if i == 0:
                        data = sys.stdin.readline().strip()
                        if data: send(self.sock, data)
                    elif i == self.sock:
                        data = receive(self.sock)
                        if not data:
                            print('Shutting down.')
                            self.flag = True
                            break
                        else:
                            sys.stdout.write(data + '\n')
                            sys.stdout.flush()
                            
            except KeyboardInterrupt:
                print('Interrupted.')
                self.sock.close()
                break
コード例 #2
0
ファイル: application.py プロジェクト: mongonzales/shoot
def signup():
    data = request.get_json()
    appt_id = data["id"]
    name = data["name"]
    email = data["email"]
    phone = data["phone"]
    category = data["category"]
    position = data["position"]
    time = data["time"]
    appt = Appointment.query.get(appt_id)
    if (not appt) or appt.filled:
        return "Failed", 400
    else:
        # Fill the appointment
        appt.filled = True
        appt.name = name
        appt.position = position
        appt.category = category
        appt.email = email
        appt.phone = phone
        db.session.commit()

        send(name, position, time, appt.location, category, email, phone)

        # Notify me
        return "Success", 200
コード例 #3
0
ファイル: test_emit.py プロジェクト: alanoe/pulp
    def test_send_disabled(self, mock_config):
        """
        Ensure we bail out immediately if 'event_notifications_enabled' is False
        """
        doc = mock.Mock()
        # NB: 'event_notifications_enabled' is the only config param found via
        # getboolean() in emit.py
        mock_config.getboolean.return_value = False

        send(doc)

        assert not doc.to_json.called
コード例 #4
0
ファイル: test_emit.py プロジェクト: alanoe/pulp
    def test_send_unserializable(self, mock_config, mock_logger):
        """
        Ensure we bail out if doc is not serializable
        """
        doc = mock.Mock()
        doc.to_json.side_effect = TypeError("boom!")
        mock_config.getboolean.return_value = True

        send(doc)

        mock_logger.warn.assert_called_once_with('unable to convert document to JSON; '
                                                 'event message not sent')
コード例 #5
0
ファイル: test_emit.py プロジェクト: taftsanders/pulp
    def test_send_disabled(self, mock_config):
        """
        Ensure we bail out immediately if 'event_notifications_enabled' is False
        """
        doc = mock.Mock()
        # NB: 'event_notifications_enabled' is the only config param found via
        # getboolean() in emit.py
        mock_config.getboolean.return_value = False

        send(doc)

        assert not doc.to_json.called
コード例 #6
0
ファイル: test_emit.py プロジェクト: taftsanders/pulp
    def test_send_unserializable(self, mock_config, mock_logger):
        """
        Ensure we bail out if doc is not serializable
        """
        doc = mock.Mock()
        doc.to_json.side_effect = TypeError("boom!")
        mock_config.getboolean.return_value = True

        send(doc)

        mock_logger.warn.assert_called_once_with(
            'unable to convert document to JSON; '
            'event message not sent')
コード例 #7
0
def main():
    config = ConfigParser.ConfigParser()
    config.read("config.ini")
    smtpserver = config.get("mail", "smtpserver")
    smtpport = config.get("mail", "smtpport")
    secret_user = config.get("mail", "user")
    user = ""
    for i in range(0, len(secret_user)):
        user += chr(ord(secret_user[i]) ^ 7)
    secret_passwd = config.get("mail", "passwd")
    passwd = ""
    for i in range(0, len(secret_passwd)):
        passwd += chr(ord(secret_passwd[i]) ^ 5)
    autostart = config.get("settings", "autostart")
    startsend = config.get("settings", "startsend")
    delay = float(config.get("settings", "delay"))
    if startsend == "1":
        time.sleep(60 * delay)
        pc_name = socket.gethostname()
        current_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
        url = "http://1212.ip138.com/ic.asp"
        try:
            page = urllib2.urlopen(url)
        except:
            pass
        else:
            text = page.read()
            if "<center>" in text and "</center>" in text:
                text = text[text.index("<center>") + 8 : text.index("</center>")]
                info_list = text.split(" ")
                ip = info_list[0]
                ip = ip[ip.index("[") + 1 :]
                ip = ip[: ip.index("]")]
                location = info_list[1]
                location = location[6:]
                title = "您的电脑当前有开机动作!"
                message = "<p>电脑名称:%s</p><p>开机时间:%s</p><p>IP地址:%s</p><p>地理位置:%s</p>" % (
                    pc_name,
                    current_time,
                    ip,
                    location.decode("gb2312").encode("utf8"),
                )
                send(smtpserver, smtpport, user, user, passwd, title=title, msg=message)
    try:
        os.startfile("Email My PC.exe")
    except:
        pass
    finally:
        sys.exit()
コード例 #8
0
ファイル: Main_CLI.py プロジェクト: Anas9935/WifiShare
def gotoSendFile(pool, sMain):
    global currentPortAddress
    filepaths = askopenfilenames()
    num_files = len(filepaths)
    send(sMain, "Length" + SEPARATOR + str(num_files) + "\n", 'utf-8')
    print("send", num_files)
    #msg=receive(sMain,BUFFER_SIZE_VERY_SMALL,'utf-8')
    req = ""
    while True:
        msg = receive(sMain, 1, 'utf-8')
        print(msg, end="")
        if (msg != '\n'):
            req += msg
        else:
            req += msg
            break
    ports = []
    if (req == RECEIVING_ACK):
        for filepath in filepaths:
            filename = os.path.basename(filepath)
            filesize = int((os.stat(filepath)).st_size)
            currentPortAddress += 2
            fileInfo = filename + SEPARATOR + str(filesize) + SEPARATOR + str(
                currentPortAddress) + "\n"
            ports.append(currentPortAddress)
            send(sMain, fileInfo, 'utf-8')
        msg = receive(sMain, BUFFER_SIZE_SMALL, 'utf-8')
        if (msg == RECEIVING_ACK):
            #file data is sent, now send the files on separate threads
            i = 0
            #			print("its done ipto sending data")
            for filepath in filepaths:
                filesize = int((os.stat(filepath)).st_size)
                pool.apply_async(sendFile,
                                 args=(
                                     filepath,
                                     i,
                                     ports[i],
                                     filesize,
                                 ))
                i += 1

        pool.close()
        pool.join()
        currentPortAddress -= 2 * num_files
        return True
    print("File cant  be reached: FILEOPENERROR")
    return False
コード例 #9
0
	def set_absolute(self, x, y, player):
		x = float(x) / 100.0 * DISPLAY_WIDTH
		y = float(y) / 100.0 * DISPLAY_HEIGHT
		target_zone = self._target_zone
		if target_zone is not None:
			xmin, xmax, ymin, ymax = target_zone
			a = (xmax - xmin) / DISPLAY_WIDTH
			b = xmin
			x = int(a * x + b)
			a = (ymax - ymin) / DISPLAY_HEIGHT
			b = ymin
			y = int(a * y + b)
		else:
			x = int(x)
			y = int(y)
		send('cursor', action='send_mouse', sender=player, x=x, y=y)
		return None
コード例 #10
0
def main():
	config = ConfigParser.ConfigParser()
	config.read("config.ini")
	smtpserver = config.get("mail", "smtpserver")
	smtpport = config.get("mail", "smtpport")
	secret_user = config.get("mail", "user")
	user = ""
	for i in range(0,len(secret_user)):
		user += chr(ord(secret_user[i]) ^ 7)
	secret_passwd = config.get("mail", "passwd")
	passwd = ""
	for i in range(0,len(secret_passwd)):
		passwd += chr(ord(secret_passwd[i]) ^ 5)
	autostart = config.get("settings", "autostart")
	startsend = config.get("settings", "startsend")
	delay = float(config.get("settings", "delay"))
	if startsend == "1":
		time.sleep(60 * delay)
		pc_name = socket.gethostname()
		current_time = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
		url = "http://1212.ip138.com/ic.asp"
		try:
			page = urllib2.urlopen(url)
		except:
			pass
		else:
			text = page.read()
			if "<center>" in text and "</center>" in text:
				text = text[text.index("<center>") + 8:text.index("</center>")]
				info_list = text.split(" ")
				ip = info_list[0]
				ip = ip[ip.index("[")+1:]
				ip = ip[:ip.index("]")]
				location = info_list[1]
				location = location[6:]
				title = "您的电脑当前有开机动作!"
				message = "<p>电脑名称:%s</p><p>开机时间:%s</p><p>IP地址:%s</p><p>地理位置:%s</p>" % (pc_name, current_time, ip, location.decode("gb2312").encode("utf8"))
				send(smtpserver, smtpport, user, user, passwd, title=title, msg=message)
	try:
		os.startfile("Email My PC.exe")
	except:
		pass
	finally:
		sys.exit()
コード例 #11
0
ファイル: test_emit.py プロジェクト: alanoe/pulp
    def test_send(self, mock_exchange, mock_conn, mock_producer, mock_config):
        """
        Test a successful send
        """
        doc = mock.Mock()
        doc.to_json.return_value = '{"a": "B"}'
        mock_config.getboolean.return_value = True
        mock_config.get.return_value = "amqp://some.amqp.url/"

        mock_exchange_instance = mock.Mock()
        mock_exchange.return_value = mock_exchange_instance

        mock_producer_instance = mock.Mock()
        mock_producer.return_value = mock_producer_instance

        send(doc)

        mock_producer_instance.maybe_declare.assert_called_once_with(mock_exchange_instance)
        mock_producer_instance.publish.assert_called_once_with('{"a": "B"}', routing_key=None,
                                                               exchange=mock_exchange_instance)
コード例 #12
0
ファイル: test_emit.py プロジェクト: taftsanders/pulp
    def test_send(self, mock_exchange, mock_conn, mock_producer, mock_config):
        """
        Test a successful send
        """
        doc = mock.Mock()
        doc.to_json.return_value = '{"a": "B"}'
        mock_config.getboolean.return_value = True
        mock_config.get.return_value = "amqp://some.amqp.url/"

        mock_exchange_instance = mock.Mock()
        mock_exchange.return_value = mock_exchange_instance

        mock_producer_instance = mock.Mock()
        mock_producer.return_value = mock_producer_instance

        send(doc)

        mock_producer_instance.maybe_declare.assert_called_once_with(
            mock_exchange_instance)
        mock_producer_instance.publish.assert_called_once_with(
            '{"a": "B"}', routing_key=None, exchange=mock_exchange_instance)
コード例 #13
0
ファイル: Main_CLI.py プロジェクト: Anas9935/WifiShare
def gotoRecvFile(pool, sMain):
    msg = recvGetline(sMain)

    msg = msg.split(SEPARATOR)
    num_files = int(msg[1])
    send(sMain, RECEIVING_ACK, 'utf-8')
    fileinfo = []
    for i in range(num_files):
        fileinfo.append(recvGetline(sMain))
    send(sMain, RECEIVING_ACK, 'utf-8')
    for i in range(num_files):
        f = fileinfo[i].split(SEPARATOR)
        filename = f[0]
        filesize = int(f[1])
        port = int(f[2])
        #create thread for each file
        pool.apply_async(receiveFile, args=(filename, filesize, port, i))

    pool.close()
    pool.join()
    return True
コード例 #14
0
ファイル: Main_CLI.py プロジェクト: Anas9935/WifiShare
def check_conn(s):
    send(s, CONNECTION_ESTABLISHED_SERVER, 'utf-8')
    ack = receive(s, BUFFER_SIZE_VERY_SMALL, 'utf-8')
    if (ack == RECEIVING_ACK):
        #the sent packet is acknowledged
        print("UPLOADING SUCCESS")
        globalUpl = 1
    else:
        print("UPLOADING FAILED")
        globalUpl = 0
        s.close()
    msg = receive(s, BUFFER_SIZE_VERY_SMALL, 'utf-8')
    if (msg == CONNECTION_ESTABLISHED_CLIENT):
        #the message is received
        send(s, RECEIVING_ACK, 'utf-8')
        print("DOWNLOADING SUCCESS")
        globalDown = 1
    else:
        print("DOWNLOADING FAILED")
        globalDown = 0
        s.close()
コード例 #15
0
 def __init__(self, name, host='127.0.0.1', port=3490):
     self.name = name
     # Quit flag
     self.flag = False
     self.port = int(port)
     self.host = host
     # Initial prompt
     self.prompt='[' + '@'.join((name, socket.gethostname().split('.')[0])) + ']> '
     # Connect to server at port
     try:
         self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         self.sock.connect((host, self.port))
         print('Connected to chat server@%d' % self.port)
         # Send my name...
         send(self.sock,'NAME: ' + self.name) 
         data = receive(self.sock)
         # Contains client address, set it
         addr = data.split('CLIENT: ')[1]
         self.prompt = '[' + '@'.join((self.name, addr)) + ']> '
     except socket.error, e:
         print('Could not connect to chat server @%d' % self.port)
         sys.exit(1)
コード例 #16
0
def main():
    config = ConfigParser.ConfigParser()
    config.read("config.ini")
    smtpserver = config.get("mail", "smtpserver")
    user = config.get("mail", "user")
    passwd = config.get("mail", "passwd")
    autostart = config.get("settings", "autostart")
    startsend = config.get("settings", "startsend")
    if autostart == "1" and startsend == "1":
        pc_name = socket.gethostname()
        current_time = time.strftime('%Y-%m-%d %H:%M:%S',
                                     time.localtime(time.time()))
        url = "http://1212.ip138.com/ic.asp"
        try:
            page = urllib2.urlopen(url)
        except:
            pass
        else:
            text = page.read()
            if "<center>" in text and "</center>" in text:
                text = text[text.index("<center>") + 8:text.index("</center>")]
                info_list = text.split(" ")
                ip = info_list[0]
                ip = ip[ip.index("[") + 1:]
                ip = ip[:ip.index("]")]
                location = info_list[1]
                location = location[6:]
                title = "您的电脑当前有开机动作!"
                message = "电脑名称:%s\n开机时间:%s\nIP地址:%s\n地理位置:%s" % (
                    pc_name, current_time, ip,
                    location.decode("gb2312").encode("utf8"))
                send(smtpserver, user, passwd, title=title, msg=message)
    try:
        os.startfile("Email My PC.exe")
    except:
        pass
    finally:
        sys.exit()
コード例 #17
0
ファイル: Main_CLI.py プロジェクト: Anas9935/WifiShare
def receiveFile(filename, filesize, port, i):
    try:
        import os
        import socket
        from constants import BASEPATH, BUFFER_SIZE_MEDIUM, REQUEST_TO_SEND, SEPARATOR, ALLOW_TO_RECV
        from wifiUtils import getIpAddress
        from main import send, receive, recvGetline
        f = open(BASEPATH + filename, "wb")
        subSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        subSock.bind((getIpAddress(), port))
        subSock.listen()
        print("Socket for ", i, " created")
        conn, addr = subSock.accept()
        print("connection created ", addr)
        #msg="REQUEST_TO_SEND"+SEPARATOR+str(i)+"\n"
        #send(conn,msg,'utf-8')
        msg = recvGetline(conn)
        #print(msg)
        msg = msg.split(SEPARATOR)
        msg[0] += "\n"
        if (msg[0] == REQUEST_TO_SEND and int(msg[1]) == i):
            print("Request arrived")
            msg = "ALLOW_TO_RECV" + SEPARATOR + str(i) + "\n"
            send(conn, msg, 'utf-8')

            iter = filesize
            print("iter", iter)
            while True:
                bytes_read = receive(
                    conn, BUFFER_SIZE_MEDIUM)  #conn.recv(BUFFER_SIZE_MEDIUM)
                iter -= len(bytes_read)
                f.write(bytes_read)
                if (iter <= 0):
                    break
            print("File is saved ", i)
        subSock.close()
    except Exception as ex:
        print(ex)
コード例 #18
0
ファイル: monitor.py プロジェクト: laiyongqin/api_monitor
 def run(self):
     global queue
     for x in a:
         result = queue.get()
         user = c.user_select(result[0][8])
         if result[0][4] != 'Yes': continue
         if result[1] == 0:
             if r.redis_select(result[0][0]) == 0: continue
             if r.redis_select(result[0][0]) < 3:
                 r.redis_modify(result[0][0])
                 with open('/data/scripts/monitor/sms.txt', 'a+') as f:
                     f.write('%s\t%s\t%s\n' %
                             (result[0][1], result[0][2], result[0][3]))
                 c.insert_log(result)
             else:
                 content = '''Group:  %s   URL :  %s  恢复正常''' % (
                     result[0][2], result[0][3])
                 title = 'URL恢复正常'
                 send(title, content, user)
                 r.redis_modify(result[0][0])
         elif result[1] != 0:
             if r.redis_select(result[0][0]) < 3:
                 r.redis_insert(result[0][0])
             else:
                 title = 'URL检测失败'
                 if result[1] == 1:
                     content = '''Group:  %s   URL :  %s  关键字检测失败!!!''' % (
                         result[0][2], result[0][3])
                     send(title, content, user)
                     c.update_time(result[0][0])
                     r.redis_insert(result[0][0])
                 elif result[1] == 2:
                     content = '''Group:  %s   URL :  %s  返回状态码错误!!!''' % (
                         result[0][2], result[0][3])
                     send(title, content, user)
                     c.update_time(result[0][0])
                     r.redis_insert(result[0][0])
                 elif result[1] == 3:
                     content = '''Group:  %s   URL :  %s  超5s 没有返回数据!!!''' % (
                         result[0][2], result[0][3])
                     send(title, content, user)
                     c.update_time(result[0][0])
                     r.redis_insert(result[0][0])
コード例 #19
0
ファイル: Main_CLI.py プロジェクト: Anas9935/WifiShare
def sendFile(filepath, i, port, filesize):
    try:
        import socket
        import os
        from constants import BUFFER_SIZE_MEDIUM, SEPARATOR
        from wifiUtils import getIpAddress
        from main import send
        from main import receive
        print("Port :", port)
        subsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        subsock.bind((getIpAddress(), port))

        subsock.listen()
        print("Waiting", i)
        conn, addr = subsock.accept()
        print("Connection established", i, addr)
        msg = "REQUEST_TO_SEND" + SEPARATOR + str(i) + "\n"
        send(conn, msg, 'utf-8')
        recv = ""
        while True:
            ch = receive(conn, 1, 'utf-8')
            if (ch != '\n'):
                recv += ch
            else:
                recv += ch
                break
        exp = "ALLOW_TO_RECV" + SEPARATOR + str(i) + "\n"
        if (recv == exp):
            print("request accepted", i)
            #sending file by bytes
            f = open(filepath, "rb")
            byte = f.read(BUFFER_SIZE_MEDIUM)
            count = 0
            a = 0
            print("Sending in progress", end=" ")
            while byte:
                send(conn, byte)
                byte = f.read(BUFFER_SIZE_MEDIUM)
                count += len(byte)
                #print(".",end="")
            rem = filesize % BUFFER_SIZE_MEDIUM
            byte = f.read(rem)
            send(conn, byte)
            conn.close()
        else:
            print("receiving not allowed")
            conn.close()
    except Exception as ex:
        print(ex)
コード例 #20
0
ファイル: monitor.py プロジェクト: ListFranz/api_monitor
    def run(self):
        global queue
        for x in a:
            result = queue.get()
            user = c.user_select(result[0][8])
            if result[0][4] != 'Yes':continue
            if result[1] == 0:
                if r.redis_select(result[0][0]) == 0:continue
                if r.redis_select(result[0][0]) < 3:
                    r.redis_modify(result[0][0])
                    with open('/data/scripts/monitor/sms.txt','a+') as f:
                        f.write('%s\t%s\t%s\n' %(result[0][1],result[0][2],result[0][3]))
                    c.insert_log(result)
                else:
		    content = '''Group:  %s   URL :  %s  恢复正常''' %(result[0][2],result[0][3])
                    title = 'URL恢复正常'
                    send(title,content,user)
                    r.redis_modify(result[0][0])
            elif result[1] != 0:
                if r.redis_select(result[0][0]) < 3:
                    r.redis_insert(result[0][0])
                else:
                    title = 'URL检测失败'
                    if result[1] == 1:
                        content = '''Group:  %s   URL :  %s  关键字检测失败!!!''' %(result[0][2],result[0][3])
                        send(title,content,user)
                        c.update_time(result[0][0])
                        r.redis_insert(result[0][0])
                    elif result[1] == 2:
                        content = '''Group:  %s   URL :  %s  返回状态码错误!!!''' %(result[0][2],result[0][3])
                        send(title,content,user)
                        c.update_time(result[0][0])
                        r.redis_insert(result[0][0])
                    elif result[1] == 3:
                        content = '''Group:  %s   URL :  %s  超5s 没有返回数据!!!''' %(result[0][2],result[0][3])
                        send(title,content,user)
                        c.update_time(result[0][0])
                        r.redis_insert(result[0][0])
コード例 #21
0
#1.第一种使用方法
#import send
#send.send()
#2.第二种使用方法
from send import *
send()
sendmsg()

コード例 #22
0
def main():
    # 发女朋友
    send()
    # 秀恩爱
    show()
コード例 #23
0
ファイル: main.py プロジェクト: cc5312/transfer
from send import *
from utils import *

if __name__ == "__main__":
    conf = load_config()
    if len(sys.argv) < 2:
        print(
            "you must set as first argument \"send\", \"receive\" or \"mitm\"")
        exit(0)
    elif sys.argv[1] == "send":
        if len(sys.argv) != 4:
            print(
                "send should have only two arguments: <destination> and <filename>"
            )
            exit(0)
        send(conf, sys.argv[2], sys.argv[3])
    elif sys.argv[1] == "receive":
        if len(sys.argv) != 4:
            print(
                "send should have only two arguments: <port> <recv_filename>")
            exit(0)
        receive(conf, sys.argv[2], sys.argv[3])
    elif sys.argv[1] == "mitm":
        if len(sys.argv) != 6:
            print(
                "send should have only four arguments: <recv_port> <dest_ip> <dest_port> <recv_filename>"
            )
            exit(0)
        mitm(conf, sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
    else:
        print(
コード例 #24
0
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 ([email protected])
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[self._target_zone = target_zone
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb756e54c>}
nname: 188
n 188(None)[send('cursor', action='send_mouse', sender=player, x=x, y=y)
return None
]:
	i: 61(), 163()
	o: 

nname: 163
n 163(None)[x = int(x)
y = int(y)
]:
	i: 0(f)
	o: 188()

nname: 61
n 61(None)[xmin, xmax, ymin, ymax = target_zone
a = (xmax - xmin) / DISPLAY_WIDTH
コード例 #25
0
ファイル: ip_spoofing.py プロジェクト: madkasper/NetworkHacks
#!/usr/bin/python

import sys
srom scapy.all import send, IP, ICMP

if len(sys.argv) < 3:
	print sys.argv[0] + " <src_ip> <dst_ip>"
	sys.exit(1)

packet = IP(src=sys.argv[1], dst=sys.argv[2]) / ICMP()
answer = send(packet)

if answer: 
	answer.show()
コード例 #26
0
ファイル: views.py プロジェクト: mmcpro4/info3180-project2
def swishlist(uid):
    user = db.session.query(User).filter_by(uid=uid).first()
    if request.method == "POST":
        lst = []
        if not request.json:
            flash(str(user) + " Sorry but something is went wrong, our bad")
            abort(400)
        if user:
            if 'emails' in request.json:
                lst.append(request.json['email1'])
                lst.append(request.json['email2'])
                lst.append(request.json['email3'])
            if not lst:
                flash(
                    str(user) + " Sorry but something is went wrong, our bad")
                abort(400)
            from_name = user.name
            from_addr = user.email
            Topic = "The best Wishlist"
            userpage = app.config["LINK"]
            message = "This was my wish list check it out and tell me what you think later! " + "" + userpage
            for i in lst:
                send(i, user.name, user.email, Topic, message)
            info = {'persons': lst}
            response = jsonify({
                "error": None,
                "info": info,
                "message": "Success"
            })
            return response
        else:
            flash(
                str(user) +
                " Sorry but we couldnt find you in our emails that were entered"
            )
            abort(404)
    elif request.method == "GET":
        if user:
            wishlst = []
            wishes = db.session.get_bind().execute(select, id=user.id)
            if wishes:
                for i in wishes:
                    wish = {
                        'pid': i["pid"],
                        'name': i["name"],
                        'description': i["description"],
                        'url': i["url"],
                        'thumbnail_url': i["thumbnail"]
                    }
                    wishlst.append(wish)
                errors = None
                message = "Success"
                info = {"wishes": wishlst, "user": user.name}
            else:
                errors = True
                message = "Something went wrong we couldnt find the wishes you were looking for"
                info = {"wishes": wishlst, "user": user.name}
            return jsonify(error=errors, info=info, message=message)
        else:
            flash(
                str(user) + " Sorry but we couldn't find you in our database")
            abort(404)