Exemple #1
0
	def get_body(self, id=None, username = None, show=True):
		params = {
			'action':'readMessage',
			'login':username,
			'domain':'1secmail.com',
			'id':str(id)
		}
		
		if not id:
			inbox = self.inbox(username)
			inbox.reverse()
			debug(inbox = inbox)
			data = self.build_dict(inbox, 'id')
			debug(data = data)
			if data:
				n = 1
				for i in data:
					if len(str(n)) == 1:
						number = '0' + str(n)
					else:
						number = str(n)
					print(make_colors(number, 'lb') + ". " + make_colors(data.get(i).get('from'), 'lw', 'bl') + " " + make_colors("(" + data.get(i).get('subject') + ")", 'b','ly') + " " + make_colors("[" + data.get(i).get('date') + "]", 'b', 'lg') + make_colors("[" + str(i) + "]", 'lw', 'm'))
					n+=1
				q = raw_input(make_colors("Select Number: ", 'lr','lw'))
				if q and str(q).strip().isdigit() and int(str(q).strip()) <= len(inbox):
					params.update({'id':str(list(data.keys())[int(str(q).strip()) - 1])})			
			else:
				print(make_colors("No Inbox !", 'lw','lr', ['blink']))
				return False
				
		return self.print_message(params, show)
    def monitor(self, sleep=1, to_db = True, to_text = True):
        if self.config.get_config('sleep', 'time'):
            if self.config.get_config('sleep', 'time').isdigit():
                sleep = int(self.config.get_config('sleep', 'time'))
        if self.config.get_config('save', 'db') == '1':
            to_db = True
        elif self.config.get_config('save', 'db') == '0':
            to_db = False
        if self.config.get_config('save', 'text') == '1':
            to_text = True
        elif self.config.get_config('save', 'text') == '0':
            to_text = False
        clip = None
        while 1:
            try:
                if not clipboard.paste() == clip:
                    clip = clipboard.paste()
                    if to_db:
                        self.save_to_db(clip)
                    if to_text:
                        self.save_to_text(clip)
                    debug(self_width = self.width)
                    # if len(clip) > (self.width - 55):
                    # 	msg = [clip]
                    # 	msg = str(msg)[1:(self.width - 55)][:-1] + " " + make_colors("...", 'lr') + " LEN:" + make_colors(len(clip), 'lg')
                    msg = make_colors("...", 'lr') + " PID:" + make_colors(str(os.getpid()), 'ly') + " LEN:" + make_colors(len(clip), 'lg')
                    print(make_colors(self.get_now(), 'lw', 'bl') + " - " + make_colors("Clipboard Changed !", 'lw', 'lr') + " --> " + make_colors(msg, 'ly'))

                    iconpath = os.path.join(os.path.dirname(__file__), 'clips.png')
                    self.notify.notify("Clipboard Monitor", "Clipboard Changed", "Clipboard Monitor", "changed", host = None, port = None, timeout = None, iconpath = iconpath, pushbullet_api = None, nmd_api = None, growl = True, pushbullet = False, nmd = False)
                else:
                    pass
            except:
                traceback.format_exc()
            time.sleep(sleep)
Exemple #3
0
    def __init__(self, master, title="ScreenShot Viewer", images_dir="temp"):
        Frame.__init__(self, master)
        self.master = master
        if not title:
            title = image1
        if not title:
            title = "No Image"
        try:
            if title:
                master.iconbitmap(
                    os.path.join(os.path.dirname(__file__), 'favicon.png'))
            else:
                master.iconbitmap(
                    os.path.join(os.path.dirname(__file__), 'nofavicon.ico'))
        except:
            pass
        self.image = glob.glob(images_dir + "\*")
        debug(self_image=self.image)
        self.size = (0, 0)

        master.wm_title(title)
        self.pack()
        # self.createWidgets(image1)
        master.resizable(0, 0)
        if self.image:
            self.showImage1()
            self.showNextButton()
        else:
            self.showNoImage(master)

        self.n = 0
        self.binder(master)

        self.first_center()
        self.center()
	def showImage(self):
		images = None
		try:
			images = self.image[self.n]
		except:
			pass
		debug(images = images)
		debug(self_n = self.n)
		if images:
			img = Image.open(images)
			self.size = img.size
			debug(self_size = self.size)
			# all_size_width = [self.setSize(img)[0], 0, 0]
			# all_size_height = [self.setSize(img)[1], 0, 0]
			# final_width = sum(all_size_width) + 40
			# final_height = sum(all_size_height) + 50
			final_width = self.size[0] + 50
			final_height = self.size[1] + 50
			debug(final_width = final_width)
			debug(final_height = final_height)
			self.first_center(int(str(final_width).split(".")[0]), int(str(final_height).split(".")[0]))
			self.photo2 = ImageTk.PhotoImage(img.convert("RGB"))
			self.label2 = Label(self, image=self.photo2)
			self.label2.grid(rowspan=1)		
			self.label2.grid(row=0, column=0, padx=5, pady=5, rowspan=10)
		else:
			self.showNoImage()
		# except:
		# 	self.showNoImage()
		self.center()
Exemple #5
0
    def find(cls, query, ftype="artist"):
        '''
        	ftype: "artist | album | track | playlist" (str)
        '''
        if not cls.deezer:
            print(make_colors("Invalid ARL !", 'lw', 'lr'))
            return False

        result = False
        if ftype == 'artist':
            debug(ftype=ftype)
            while 1:
                try:
                    result = cls.deezer.search_artists(query)
                    break
                except:
                    pass
        elif ftype == 'album':
            result = cls.deezer.search_albums(query)
        elif ftype == 'track':
            result = cls.deezer.search_tracks(query)
        elif ftype == 'playlist':
            result = cls.deezer.search_playlists(query)
        else:
            print(make_colors("Invalid ftype !", 'lw', 'lr'))
            return False
        debug(result=result)
        return result
Exemple #6
0
	def print_message(self, params, show=True):
		debug(params = params)
		a = requests.get(self.url, params = params)
		content = a.content
		debug(content = content)
		if content and not content == "Message not found":
			content = ast.literal_eval(content)
			debug(content = content)
			#from pprint import pprint
			#pprint(content)
			#clipboard.copy(content.get('textBody')
			debug(content_keys = content.keys())
			if show:
				print(make_colors('Subject', 'ly') + "    :" +  make_colors(content.get('subject'), 'b', 'ly'))
				print(make_colors('Date', 'lg') + "       :" +  make_colors(content.get('date'), 'b', 'lg'))
				print(make_colors('Attachments', 'lm') + ":" +  make_colors(content.get('attachment'), 'lw', 'lm'))
				print(make_colors('Message', 'lc') + "    :" +  make_colors(content.get('textBody'), 'lw', 'bl'))
				qc = raw_input(make_colors("open full html message [y/n]: ", 'lw', 'lr'))
				if qc:
					qc = str(qc).strip()
				if qc == 'y':
					import browser
					html = content.get('htmlBody').replace("\\/", "/")
					debug(html = html)
					browser.main(html, title="Messages")								
		return content
Exemple #7
0
 def split_number(cls, x):
     debug(x=x)
     fr, to = x.split("-")
     fr = fr.strip()
     to = to.strip()
     track_number = list(range(int(fr), int(to) + 1))
     return track_number
Exemple #8
0
 def format_argument(self, argument):
     arg = re.split("_", argument)
     debug(arg=arg)
     arg_1 = []
     for i in arg:
         arg_1.append(str(i).title())
     debug(arg_1=arg_1)
     return "".join(arg_1)
Exemple #9
0
    def showImage1(self, event=None):
        img = Image.open(self.image[0])
        self.size = img.size
        debug(setsize=self.setSize(img))
        all_size_width = [self.setSize(img)[0], 0, 0]
        all_size_height = [self.setSize(img)[1], 0, 0]
        final_width = sum(all_size_width[:-1]) + 70
        final_height = sum(all_size_height[1:]) + 40
        self.first_center(final_width, final_height)

        self.photo2 = ImageTk.PhotoImage(img.convert("RGB"))
        self.label2 = Label(self, image=self.photo2)
        self.label2.grid(row=0, column=0, padx=5, pady=5, rowspan=10)
Exemple #10
0
 def get_library(self):
     if not self.session:
         self.session = self.get_config()
     url = self.url + "/emby/Library/VirtualFolders"
     try:
         content = self.session.get(url).json()
     except:
         #print(make_colors("Invalid API or Error connection !", 'lw', 'lr', ['blink']))
         print("\n")
         sys.exit(
             make_colors("Invalid API or Error connection !", 'lw', 'lr',
                         ['blink']))
     debug(content=content)
     return content
Exemple #11
0
    def pagination(self, url, bs_object=None):
        if not bs_object:
            a = requests.get(url)
            bs_object = bs(a.content, 'lxml')
            b = bs_object
        else:
            b = bs_object

        div_fr_ta_right = b.find('div', {'class': 'fr ta_right'})
        debug(div_fr_ta_rightv=div_fr_ta_right)
        if div_fr_ta_right:
            nums_page = None
            nums_page = div_fr_ta_right.find(
                'a', {'title': 'Navigate to last page'})
            debug(nums_page=nums_page)
            #self.pause()
            if nums_page:
                nums_page = nums_page.text
            debug(nums_page=nums_page)
            all_a = div_fr_ta_right.find_all('a')
            pages = {}
            for i in all_a:
                try:
                    pages.update({int(i.text): i.get('href')})
                except:
                    pages.update({i.text: i.get('href')})
            debug(pages=pages)

            return nums_page, pages
        return False, False
Exemple #12
0
 def format_configname(self, configname = None):
     if not configname:
         return None
     if not os.path.split(configname)[0]:
         configname = os.path.abspath(configname)
     configname_ext = os.path.splitext(configname)[1]
     configname_name = os.path.basename(os.path.splitext(configname)[0])
     configname_temp = os.path.abspath(configname_name) + "_temp" + configname_ext
     debug(configname = configname)
     with open(configname, 'rb') as f:
         f1 = f.read().decode('utf-16')
         #print("f1 =", f1)
     with open(configname_temp, 'wb') as g:
         g.write(f1)
     return configname_temp
Exemple #13
0
 def get_user_data(self, token=None, debugx=False):
     if not token:
         token = self.CONFIG.read_config('AUTH', 'token')
     if not token:
         print make_colors('NO TOKEN FOUND !', 'lr', 'lw', ['blink'])
         return False
     url = "user/me"
     url = self.url + url
     params = {
         'token': token,
     }
     debug(token=token, debug=debugx)
     a = requests.get(url, params=params)
     content = a.content
     debug(content=content, debug=debugx)
Exemple #14
0
 def __init__(self, configname = None):
     self.configname = configname
     self.config = None
     debug(self_configname = self.configname)
     self.real_configname = os.path.join(os.path.dirname(__file__), 'test.hcp')
     if not self.configname:
         self.configname = os.path.join(os.path.dirname(__file__), 'test.hcp')
     debug(self_configname = self.configname)
     if self.configname:
         self.configname = self.format_configname(self.configname)
     if not self.configname:
         self.configname = raw_input(make_colors('config name: ', 'lw', 'lr', ['blink']))
     if not self.configname:
         print(make_colors("Invalid config name !", 'lw', 'lr', ['blink']))
     if self.configname:
         self.config = configset(self.configname)
 def save_to_db(self, clip):
     import sqlite3
     file_db = os.path.join(os.path.dirname(__file__), 'clips.db3')
     conn = sqlite3.connect(file_db)
     curs = conn.cursor()
     CREATE_TABLE = "CREATE TABLE IF NOT EXISTS clips ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'date' DATETIME NOT NULL, 'clip' TEXT)"
     INSERT_TABLE = 'INSERT INTO clips ("date", "clip") values("{0}", "{1}")'
     curs.execute(CREATE_TABLE)
     conn.commit()
     data_insert = INSERT_TABLE.format(self.get_now(), unicode(re.sub('"', "'", clip)).encode('utf-8'))
     try:
         curs.execute(data_insert)
     except:
         debug(data_insert = data_insert, debug = True)
         print(traceback.format_exc())
     conn.commit()
Exemple #16
0
    def setting_set_dlna(self,
                         enable_server=True,
                         enable_play_to=True,
                         enable_debug_log=True,
                         blast_alive_messages=True,
                         client_discovery_interval_seconds=60,
                         alive_message_interval_seconds=1800,
                         default_user_id=None):
        if not default_user_id:
            default_user_id = self.setting_get_users()[0].get('Id')
        if enable_server == False or enable_server == 0:
            enable_server = "false"
        else:
            enable_server = "true"
        if enable_play_to == False or enable_play_to == 0:
            enable_play_to = "false"
        else:
            enable_play_to = "true"
        if enable_debug_log == False or enable_debug_log == 0:
            enable_debug_log = "false"
        else:
            enable_debug_log = "true"
        if blast_alive_messages == False or blast_alive_messages == 0:
            blast_alive_messages = "false"
        else:
            blast_alive_messages = "true"
        if client_discovery_interval_seconds == False or client_discovery_interval_seconds == 0:
            client_discovery_interval_seconds = "false"
        else:
            client_discovery_interval_seconds = "true"
        if alive_message_interval_seconds == False or alive_message_interval_seconds == 0:
            alive_message_interval_seconds = "false"
        else:
            alive_message_interval_seconds = "true"

        data = {
            'EnableServer': enable_server,
            'EnablePlayTo': enable_play_to,
            'EnableDebugLog': enable_debug_log,
            'BlastAliveMessages': blast_alive_messages,
            'ClientDiscoveryIntervalSeconds':
            client_discovery_interval_seconds,
            'AliveMessageIntervalSeconds': alive_message_interval_seconds,
            'DefaultUserId': default_user_id
        }
        data = json.dumps(data)
        debug(data=data)
        url = self.url + "/emby/System/Configuration/dlna"
        debug(url=url)
        if not self.session:
            self.session = self.get_config()
        a = self.session.post(url, data=data, headers=self.headers)
        debug(a_url=a.url)
        content = a.content
        debug(content=content)
Exemple #17
0
    def get_screenshot(self, url, bs_object=None, show=False, confirm=False):
        if not bs_object:
            a = requests.get(url)
            bs_object = bs(a.content, 'lxml')
        b = bs_object

        images = []
        scrslide_posrel = b.find('div', {'class': 'scrslide posrel'})
        debug(scrslide_posrel=scrslide_posrel)
        if not scrslide_posrel:
            #self.pause()
            print(make_colors("No Screenshot !", "lightwhite", "lightred"))
            return images
        slide = scrslide_posrel.find('div', {'class': 'slide'})

        all_image_a = slide.find_all('a')
        for i in all_image_a:
            images.append(i.get('href'))
        debug(show=show)
        if show:
            images_downloaded = []
            title, name = self.get_title(url, bs_object=b)
            if not os.path.isdir(
                    os.path.join(os.path.dirname(__file__), "temp")):
                os.makedirs(os.path.join(os.path.dirname(__file__), "temp"))
            else:
                #os.removedirs("temp")
                #os.unlink("temp")
                debug(first_screenshot_view=self.first_screenshot_view)
                if not self.first_screenshot_view:
                    import shutil
                    shutil.rmtree("temp", onerror=self.del_evenReadonly)
                    os.makedirs(os.path.join(os.path.dirname(__file__),
                                             "temp"))
            for i in images:
                if not self.first_screenshot_view:
                    self.download(
                        i, os.path.join(os.path.dirname(__file__), "temp"),
                        confirm, True)
                if os.path.isfile(
                        os.path.join(os.path.dirname(__file__), "temp",
                                     os.path.basename(i))):
                    images_downloaded.append(
                        os.path.join(os.path.dirname(__file__), "temp",
                                     os.path.basename(i)))
            debug(images_downloaded=images_downloaded)
            if len(images_downloaded) > 2:
                #tkimage.showImage(title, images_downloaded[0], images_downloaded[1], images_downloaded[1:])
                #tkimage.main("temp")
                tx = Process(target=tkimage.main, args=("temp", ))
                tx.start()
                self.first_screenshot_view = True
            return images_downloaded
        return images
 def show_last(self, n = 1):
     file_clip = os.path.join(os.path.dirname(__file__), 'clips.txt')
     data = ''
     if os.path.isfile(file_clip):
         with open(file_clip, 'rb') as f:
             clip = f.readlines()[-n:]
             debug(clip = clip)
             for i in clip:
                 data = re.split('^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}\.\d{0,8}|\n', i)
                 dd = re.findall('^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}\.\d{0,8}', i)
                 dd = filter(None, dd)
                 data = filter(None, data)
                 # print("dd =", dd)
                 # print("data =", data)
                 if dd:
                     print(make_colors(dd[0], 'lw', 'bl') + make_colors(data[0], 'ly'))
                 else:
                     if data:
                         print(make_colors(data[0], 'ly'))
	def run(self, event = None):
		debug(self_n = self.n)
		if self.n < 0:
			self.n = 0
			self.showNoImage()
		elif self.n > len(self.image):
			self.n = len(self.image)
			self.showNoImage()
		elif self.n == len(self.image):
			self.showNoImage()
		elif self.n == 0:
			self.n += 1
			self.showImage()
		else:
			self.showImage()
			if not self.n == len(self.image):
				self.n += 1
		
		debug(self_n = self.n)
Exemple #20
0
    def get_license(self, url, bs_object=None):
        if not bs_object:
            a = requests.get(url)
            bs_object = bs(a.content, 'lxml')
            b = bs_object
        else:
            b = bs_object

        license = b.find('div', {
            'class': 'grid_37 prefix_1 fr'
        }).find('span', {'class': re.compile('bold upcase license ')})
        if license:
            license = license.find('span', {
                'class': re.compile('col-')
            }).text.strip()
            return license
        else:
            debug(license=b.find('div', {'class': 'grid_37 prefix_1 fr'}))
        return " "
Exemple #21
0
 def setRestore(self, filter):
     all_str = []
     all_int = []
     for i in filter:
         if str(i).isdigit():
             all_int.append(int(i))
         else:
             all_str.append(i)
     debug(all_int=all_int)
     debug(all_str=all_str)
     hdls, h_hide, h_hide_filter, h_pids = self.getListWindows(
         filter=all_str, print_list=False, pid=all_int)
     debug(h_hide=h_hide)
     debug(h_pids=h_pids)
     if h_pids:
         if len(h_pids) > 1:
             n = 1
             for i in h_pids:
                 print(str(n) + ". " + str(i[0]))
                 n += 1
             q = raw_input(
                 "Select number to show [all = for show all of hide]: ")
             if q and str(q).isdigit() and not int(q) > len(h_pids):
                 h = h_pids[int(q) - 1][-1]
                 win32gui.ShowWindow(h, 1)
             elif q and str(q).strip() == 'all':
                 for i in h_pids:
                     win32gui.ShowWindow(i[-1], win32con.SW_RESTORE)
                     win32gui.BringWindowToTop(i[-1])
         else:
             h = h_pids[0][-1]
             win32gui.ShowWindow(h, win32con.SW_RESTORE)
             win32gui.BringWindowToTop(h)
     else:
         if h_hide:
             if len(h_hide) > 1:
                 n = 1
                 for i in h_hide:
                     print(str(n) + ". " + str(i[0]))
                     n += 1
                 q = raw_input(
                     "Select number to show [all = for show all of hide]: ")
                 if q and str(q).isdigit() and not int(q) > len(h_hide):
                     h = h_hide[int(q) - 1][-1]
                     win32gui.ShowWindow(h, 1)
                 elif q and str(q).strip() == 'all':
                     for i in h_hide:
                         win32gui.ShowWindow(i[-1], win32con.SW_RESTORE)
                         win32gui.BringWindowToTop(i[-1])
             else:
                 h = h_hide[0][-1]
                 win32gui.ShowWindow(h, win32con.SW_RESTORE)
                 win32gui.BringWindowToTop(h)
Exemple #22
0
 def _download(self,
               dllinkbox2,
               download_path=os.getcwd(),
               confirm=False,
               download_it=True):
     link = dllinkbox2.find('a').get('href')
     a2 = requests.get(link)
     b2 = bs(a2.content, 'lxml')
     download_link = b2.find('div', {
         'id': 'manstart'
     }).find('a').get('href')
     debug(download_link=download_link, debug=False)
     if download_link:
         if download_it:
             self.download(download_link, download_path, confirm)
         return download_link
     else:
         print(
             make_colors("NO Download Link Found !", "lightwhite",
                         "lightred"))
     return False
	def first_center(self, final_width=None, final_height=None):
		if final_width:
			all_size_width = [final_width, 0, 0]
		else:
			all_size_width = [self.size[0], 0, 0]
		if final_height:
			all_size_height = [final_height, 0, 0]
		else:
			all_size_height = [self.size[1], 0, 0]
		debug(final_width = final_width)
		debug(final_height = final_height)
		debug(all_size_width = all_size_width)
		debug(all_size_height = all_size_height)
		self.master.geometry("%sx%s+30+30"%(str(max(all_size_width)), str(max(all_size_height))))
Exemple #24
0
 def send(self, data="TEST", host=None, port=None):
     if not host:
         host = self.host
         if host == '0.0.0.0':
             host = '127.0.0.1'
     if not port:
         port = self.port
     debug(host=host)
     debug(port=port)
     s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     s.sendto(data, (host, port))
     try:
         data, server = s.recvfrom(8096)
         debug(data=data)
         #data = ast.literal_eval(data)
         print("OUTPUT =", data)
         #print("ERROR  =", data[1])
         #s.close()
         try:
             sys.exit()
         except:
             pass
     except:
         import traceback
         traceback.format_exc()
         print("NO DATA !")
Exemple #25
0
 def upload(self, filepath):
     filepath = os.path.realpath(filepath)
     debug(filepath=filepath)
     data = {
         'file': filepath,
     }
     url = "https://api.anonfile.com/upload"
     debug(data=data)
     a = requests.post(url, data=data)
     content = a.content
     debug(content=content)
     if content:
         content = json.loads(content)
     debug(content=content)
Exemple #26
0
	def getListProcess(self, filter = None):
		debug(filter = filter)
		all_process = psutil.process_iter()
		process = []
		for i in all_process:
			if filter:
				for f in filter:
					if str(f).isdigit():
						if int(f) == i.pid:
							process.append(i)
					else:
						if str(f).lower() == i.name() or str(f).lower() in i.name().lower():
							process.append(i)
						else:
							try:
								if str(f).lower() in i.cmdline().lower():
									process.append(i)
							except:
								pass
			else:
				process.append(i)
		return process
	def setSize(self, im):
		screen_width = self.master.winfo_screenwidth()
		screen_height = self.master.winfo_screenheight()
		debug(screen_width = screen_width)
		debug(screen_height = screen_height)
		if screen_width < im.size[0]:
			x = screen_width / 1.1
			y = screen_height / 1.1
		else:
			x = im.size[0] /  1.03
			y = im.size[1] / 1.03
		debug(x = x)
		debug(y = y)
		im.thumbnail((x, y), Image.ANTIALIAS)
		return x, y
Exemple #28
0
 def bind(self, host=None, port=None):
     if not host:
         host = self.host
     if not port:
         port = self.port
     s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     print(
         make_colors("Listen On:", 'lc') + make_colors(host, 'lw', 'bl') +
         ":" + make_colors(str(port), 'lw', 'lr'))
     try:
         s.bind((host, port))
         exit = False
         while 1:
             data, address = s.recvfrom(8096)
             if data == 'exit':
                 exit = True
                 try:
                     sys.exit()
                 except:
                     pass
             if exit:
                 break
             debug(data=data)
             debug(address=address)
             #a = os.system(data)
             try:
                 process = subprocess.Popen(data, stdout=subprocess.PIPE)
                 #(out, err) = process.communicate()
                 out = process.stdout
                 #print("out =", out.read())
                 #print("dir(out) =", dir(out))
                 err = process.stderr
                 print("OUT SERVER =", out.read())
                 debug(out=out.read())
                 debug(err=err)
                 try:
                     err = err.read()
                 except:
                     pass
                 s.sendto(str([str(out.read()), str(err)]), address)
             except:
                 os.system(data)
             #if a > 0:
             #	print(make_colors("ERROR", 'lw','lr',['blink']))
     except:
         import traceback
         traceback.format_exc()
         sys.exit()
	def previous(self, event = None):
		debug(len_self_image = len(self.image))
		debug(self_n = self.n)
		if self.n < 0:
			self.showNoImage()
			self.n = 0
		elif self.n > len(self.image):
			self.n = len(self.image)
			self.showNoImage()
		elif self.n == 0:
			self.showNoImage()	
		else:	
			self.n -= 1
			debug(self_n = self.n)
			self.showImage()
			debug(self_n = self.n)
Exemple #30
0
    def get_description(self, url, bs_object=None):
        if not bs_object:
            a = requests.get(url)
            bs_object = bs(a.content, 'lxml')
            b = bs_object
        else:
            b = bs_object

        edreview = b.find('div', {'id': 'edreview'})
        head = edreview.find('h2').find('strong', {'class': 'fl'}).text
        debug(head=head)
        mgbot_10 = edreview.find_all('p', {'class': 'mgbot_10'})
        description_pre = []
        description = []
        for i in mgbot_10:
            description_pre.append(urllib.unquote(i.text))

        for i in description_pre:
            description.append(i.encode('utf-8'))
        long_desc = "\n".join(description)
        debug(long_desc=long_desc)

        return urllib.unquote(head), long_desc, description