Пример #1
0
 def set_type(self, command: str, args: str, from_user: "******",
              chat_id: int):
     self.__advertisement = Advertisement(command, self.__language_tag,
                                          from_user.username,
                                          self.__debating_room)
     self.__state = "grand_category"
     self.gather_global_category(from_user.id)
Пример #2
0
def new_ad():
    if request.method == 'GET':
        return render_template('new_ad.html')
    elif request.method == 'POST':
        user_id = session.get("user_id")
        values = (None, request.form['title'], request.form['description'],
                  request.form['price'], request.form['date'], 1, 0, user_id)
        Advertisement(*values).create()

        return redirect('/')
Пример #3
0
def create_ad():
    if request.method == 'GET':
        return render_template('create_ad.html')
    elif request.method == 'POST':
        seller = User.find_by_username(session.get('username'))
        values = (None, seller.id, None, request.form['name'],
                  request.form['description'], request.form['price'],
                  date.today(), 1)
        Advertisement(*values).create()
        return redirect('/ads')
Пример #4
0
    def parse_ad_page(self):
        """ Parse certain ad page """
        ad = Advertisement()
        ad.title = self.get_ad_title()
        ad.description = self.get_ad_description()
        ad.location = self.get_ad_location()
        ad.details = self.get_ad_details()
        ad.contacts = self.get_ad_contacts()
        ad.url = self.driver.current_url

        print(ad)
        self.ads.append(ad)
Пример #5
0
def fetch_ads():
    """ Fetches advertisements
    """
    ad_arr = []
    with open("corrected.json", 'r') as r:
        ads_dict = json.load(r)
        for ad_dict in ads_dict[:3]:
            ad_arr.append(
                Advertisement(
                    title=ad_dict.get('name'),
                    price=500,  # har cheeze 500 me
                    image_url=ad_dict.get("image_urls")[0],
                    image_name=ad_dict.get("image_name"),
                    product_url=ad_dict.get("product_url")))
    return ad_arr
Пример #6
0
# This is the main file

# Import all of the project files
from chromosome import Chromosome
from advertisement import Advertisement

import random, time
# Project variables

pop_size = 100
mutation_rate = 0.003
budget = 2500000

advertisements = [
    Advertisement("National TV (Canada)", 1000000, 40000000, 5),
    Advertisement("National TV (USA)", 1250000, 45000000, 5),
    Advertisement("Local TV (Victoria)", 100000, 500000, 6),
    Advertisement("Local TV (Seattle)", 175000, 600000, 6),
    Advertisement("Superbowl TV", 5000000, 110000000, 8),
    Advertisement("Youtube Video Ad (Large)", 100000, 1000000, 3),
    Advertisement("Youtube Video Ad (Medium)", 80000, 750000, 3),
    Advertisement("Web Banner (Large)", 700000, 10000000, 2),
    Advertisement("Web Banner (Medium)", 500000, 8000000, 2),
    Advertisement("Radio", 600000, 15000000, 4),
    Advertisement("Newspaper (Victoria)", 50000, 550000, 3),
    Advertisement("Newspaper (Vancouver)", 75000, 600000, 3),
    Advertisement("Highway Billboard", 2000, 2000000, 1),
    Advertisement("Times Square Billboard", 4000000, 150000000, 6),
    Advertisement("Sponsored Content", 40000, 20000000, 7),
    Advertisement("Product Placement", 40000, 25000000, 6),