Beispiel #1
0
def run():
	for i in range(1000000):
		cheapSeen = False
		html = content(url)
		items = parse(html)
		item = items[0]

		if item['amount'] < THRESHOLD:
			print item['amount']
			print item['href']
			cheapSeen = True

			subject = 'Cheapest knife: %s' % item['name']
						
			if item['amount'] not in sent:
				webbrowser.open(item['href'], new=1)
				sendemail(subject.encode('utf-8'), prettyMessage(item))
				sent.append(item['amount'])

		if not cheapSeen:
			if len(items) > 0:
				print '#', i, ': Cheapest is ', items[0]['amount']


		time.sleep(1)
Beispiel #2
0
 def generateContent(self):
     c = content(settings=self.settings)
     c.paragraphs = randint(1, self.max_paragraphs)
     out = c.makeContent()
     if self.force_lower:
         out = out.lower()
     if randint(1,10) in [2, 5, 6]:
         out = self.generateQuote() + out
     return out
Beispiel #3
0
    def __init__(self):
        # Config file with indexed packages and previous date read
        self.config = config("config.json")
        self.content = content()
        self.join = osp.join
        self.mailer = mailer(self.config)

        self.data = {}
        self.authors = []
        self.files = []
        self.messages = []
Beispiel #4
0
def response(flow):
    req_url = flow.request.pretty_url
    res_headers = flow.response.headers
    req_headers = flow.request.headers
    body = flow.response.text
    status_code = flow.response.status_code

    if status_code == 200:
        if re.compile('r'mp\.weixin\.qq\.com\/mp\/profile_ext\?action=home', re.I).findall(self.req_url):
            '''启动一个线程去抓取到的页面中获取到文章列表的处理'''
            _thread.append(threading.Thread(target=content().run, args=(body)))
            body = get_next_body()

            flow.response = http.HTTPResponse.make(
                200, bytes(body, encoding='utf-8'),
                {'Content-Type': 'text/html', 'Cache-Control': 'no-cache, must-revalidate'}
            )
Beispiel #5
0
    def do_content(self):
        from content import content

        self.content = content()
        return self.content, noduplicates()
Beispiel #6
0
def content(data):
    if isinstance(data, _content.content):
        return data
    return _content.content(_ctx, data)
 def do_atom_content(self):
     from content import content
     return content()
 def do_atom_title(self):
     from content import content
     return content(), noduplicates()
 def do_atom_content(self):
   from content import content
   return content()
Beispiel #10
0
 def do_content(self):
     from content import content
     self.content = content()
     return self.content, noduplicates()
Beispiel #11
0
def content(data):
    if isinstance(data, _content.content):
        return data
    return _content.content(_ctx, data)
Beispiel #12
0
from content import content
from sendemail import sendemail
from notification import notification
import time
import webbrowser

url = "http://steamcommunity.com/market/search/render/?query=&start=0&count=10&search_descriptions=0&sort_column=price&sort_dir=asc&appid=730&category_730_ItemSet%5B%5D=any&category_730_TournamentTeam%5B%5D=any&category_730_Weapon%5B%5D=any&category_730_Type%5B%5D=tag_CSGO_Type_Knife"
linktag = "market_table_value"
nametag = "market_listing_item_name"
THRESHOLD = 30
CURRENCY = ''

html = content(url)

sent = []

def parse(html):
	arr = []
	for link in html.find_all('a'):
		href = link.get('href')
		value = link.find(attrs={'class': linktag})
		price = value.span.text
		image = link.find('img').get('src')
		name = link.find(attrs={'class', nametag}).text

		amount, currency = price[1:-4], price[:1]

		CURRENCY = currency

		arr.append({
			'amount': float(amount), 
Beispiel #13
0
 def do_atom_title(self):
   from content import content
   return content(), noduplicates()
Beispiel #14
0
from flask import Flask, request, render_template
from content import content

con = content()
app = Flask(__name__)


@app.route('/')
def index():
    return render_template("dashboard.html", con=con)


@app.route('/profile/<username>')
def profile(username):
    return render_template("profile.html", username=username)


@app.route('/display/<int:id>')
def display(id):
    return 'hey there %s' % id


if __name__ == "__main__":
    app.run(debug=True)
Beispiel #15
0
#

import menu
import content
import sys
import func

#
# set debug level,
#   0     : disabled debug
#   [...]
#   5     : max debug output
#
debug = 0

mycontent = content.content(debugLevel=debug)
mymenu = menu.mymenu(mycontent, debugLevel=debug)


def loopme():
    while True:
        mymenu.show_menu()


if len(sys.argv) < 2:
    func.info()
    loopme()
else:
    if sys.argv[1] == "--version":
        func.info()
        func.info_version()