Beispiel #1
0
def changestock(newvalue, filee):
    counter = 0
    filecontents = []
    f = open("Funkodb" + "/" + filee, "r")
    filecontents = f.read().split()
    f.close()
    f = open("Funkodb" + "/" + filee, "w")
    for a in filecontents:
        if a == "True" or a == "False":
            f.write(str(newvalue) + " ")
        else:
            f.write(a + " ")
    f.close()
    url = filee.replace("{slashhere}", "/").replace(".txt", "")
    discordmsg.send("stock has been updated to: " + str(newvalue).replace(
        "True", "in Stock").replace("False", "Not available in stock :-(") +
                    " on " +
                    filee.replace("{slashhere}", "/").replace(".txt", ""))
    try:
        discordtwo.sendproppermesage(
            url, url.replace("https://www.target.com", ""),
            get_price(url) + " $\n " + "  __Stock: False__\n Site: Target ",
            "update",
            get_price(url) + " $\n " + "  __Stock: False__\n Site: Target ",
            url)
    except:
        pass
Beispiel #2
0
def changeprice(newprice, filee):
    counter = 0
    filecontents = []
    f = open("Funkodb" + "/" + filee, "r")
    filecontents = f.read().split()
    f.close()
    f = open("Funkodb" + "/" + filee, "w")
    for a in filecontents:
        try:
            float(a)
            f.write(newprice + " ")
        except:
            f.write(a + " ")

    url = filee.replace("{slashhere}", "/").replace(".txt", "")
    discordmsg.send("price has been updated to: $" + newprice + " on " +
                    filee.replace("{slashhere}", "/").replace(".txt", ""))
    try:
        discordtwo.sendproppermesage(
            url, url.replace("https://www.target.com", ""),
            newprice + " $\n " + "  __Stock: False__\n Site: Target ",
            "update",
            newprice + " $\n " + "  __Stock: False__\n Site: Target ", url)
    except:
        pass
    f.close()
Beispiel #3
0
def savefunko(funkodoll):
    print(
        os.path.isfile(
            "Funkodb/" +
            funkodoll.url.replace(" ", "").replace("/", "{slashhere}") +
            ".txt"))
    if (False == (os.path.isfile(
            "Funkodb/" +
            funkodoll.url.replace(" ", "").replace("/", "{slashhere}") +
            ".txt"))):
        f = open(
            "Funkodb/" +
            funkodoll.url.replace(" ", "").replace("/", "{slashhere}") +
            ".txt", "w")
        f.write(funkodoll.url + " Price " + funkodoll.price +
                " stockstate = " + str(funkodoll.inStock))
        f.close()
        discordmsg.send("New Product found " + funkodoll.url)
Beispiel #4
0
def priceincreasealert(product):
    discordmsg.send(product.name + " has increased price   url : " +
                    product.url)
Beispiel #5
0
def pricedecreasealert(product):
    discordmsg.send(product.name + " is now on sale   url : " + product.url)
Beispiel #6
0
def outofstockalert(product):
    discordmsg.send(product.name + " is now out of stock url : " + product.url)
Beispiel #7
0
def instockalert(product):
    discordmsg.send(product.name + " is now in stock url : " + product.url)
Beispiel #8
0
def newproductalert(product):
    discordmsg.send("new product found" + product.name + "  url : " +
                    product.url)
Beispiel #9
0
from urllib.request import urlopen as uReq
import requests
import os
import bs4
from bs4 import BeautifulSoup as soup
import csv
import dryscrape
import re
import discordmsg
discordmsg.send("target monitor started")
nineteen = [
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
]
discordinfo = ""
discordinfo2 = ""
databasename = "targetdatabase3.csv"
databasetextname = "tDatabase"
print(os.listdir("tDatabase"))


class Product:
    stockqty = ""
    pid = ""
    name = ""
    price = ""
    url = ""
    inStock = False
    imgurl = ""
    f = ""

    def get_price(self):