Hello, so I am building a simple app here I wanted some values in my CSV to be updated in a 15 minutes, I wanted
this app to run on background. However I couldn't get it to work the way I want to.
I wanted it to run on background while I am seeing the landing page of my app. which is index HTML
Here's what I tried out:
I'm using the pandas, sched and time imports here:
#INTERFACE
@[login to view URL]("/")
def home():
s = [login to view URL]([login to view URL], [login to view URL])
[login to view URL](15, 1, timer)
[login to view URL]()
return render_template("[login to view URL]")
#TIMER
def timer():
timer = 0
csv_file='C:\Python27\Walmart\[login to view URL]'
print("UPDATING")
data_df = pd.read_csv(csv_file)
print("READ")
for i, row in [login to view URL]() :
sku = [login to view URL][i]['Walmart SKU']
print (sku)
if sku is '':
break
else:
update(sku)
print("Item Updated")
print("UPDATECOMPLETE")
home()
#UPDATE
def update(sku):
lookup=str(sku)
lookup = [login to view URL]('.0', '')
product = wapy.product_lookup(lookup)
ts = [login to view URL]()
st = [login to view URL]().strftime('%Y-%m-%d %I:%M %p')
print ([login to view URL])
if product.available_online is 'TRUE':
instock = 'yes'
else:
instock ='no'
quote_page = product.product_url
page = urlopen(quote_page)
soup = BeautifulSoup(page, '[login to view URL]')
sold_box = [login to view URL]('a', attrs={'class': 'font-bold prod-SoldShipByMsg'})
sold = [login to view URL]()
left_box = [login to view URL]('div', attrs={'class': 'prod-ProductOffer-urgencyMsg'})
left = [login to view URL]()
if left is '':
stock=[login to view URL]
else:
stock=left
# fields=[lookup + ',' + '$'+str(product.sale_price) + ',' + instock + ',' + stock + ',' + str(sold) + ',' + st + ',' + '$'+str([login to view URL])]
pathto_csv = 'C:\Python27\Walmart\[login to view URL]'
data_df = pd.read_csv(pathto_csv)
print("CSV READ")
data_df.set_value([lookup], ['Price'], '$'+str(product.sale_price))
data_df.set_value([lookup], ['In Stock'], instock )
data_df.set_value([lookup], ['Quantity'], stock)
data_df.set_value([lookup], ['Last Update'], str(sold))
data_df.set_value([lookup], ['Min Price'], '$'+str([login to view URL]))
data_df.to_csv(pathto_csv)
with open(r'[login to view URL]', 'a') as f:
writer = [login to view URL](f, delimiter=' ', quotechar = ' ')
[login to view URL](fields)
print(st)
print("UPDATED! 15 Minutes Have Passed!")
To make it short I have two problems here that I can't solve
1. On replacing the value on my update I'm getting this error:
KeyError: "['879091509'] not in index"
I am asuming here that [row],[column], would let me replace the value I want for that cell, for example"
data_df.set_value([lookup], ['Price'], '$'+str(product.sale_price))
I am reading this as, on row of where my SKU or ID is represented by ['lookup'], I will replace the ['Price'] by '$'+str(product.sale_price)
2. I can't get to my interface, because i think when the time resets it runs the code again. How can I make this run only in background?
It's just fixing a code.
Sir/Madam,
I am an experienced Python Developer with 2 years of experience. I have worked in a fintech startup for 6 months on Python libraries like Numpy, Pandas, Scikit learn. I can fix the code for you in a day. Moreover, the work will be my own not freelanced again to someone else.
Yash
xaleava project only for now, accept and get xa;eavaxaleava project only for now, accept and get xa;eavaxaleava project only for now, accept and get xa;eavaxaleava project only for now, accept and get xa;eavaxaleava project only for now, accept and get xa;eavaxaleava project only for now, accept and get xa;eava
Our elite panel of developers, deliver the most, exquisite websites and apps, for all major platforms. These products are optimized for breath-taking performance and smooth user experience, which makes your business, customer friendly and allow your sales, to shoot through the sky.
Hello,
My name is fasil a certified lead generation expert,got 6+ years of experience in lead generation. I have designed a tool that makes use of API technologies and i use that to generate leads.
I am fully expert in web research, extracting email, data mining, Google, Bing, Yahoo, MS Office,Excel, (Full), CSS
Data entry ,web scraping , B2B Marketing, Lead Generation, Directory and other related programs.
You can test the quality of my leads and also i provide leads at best price in the market
I can provide samples ,if needed
Regards
Fasil
You are encountering two distinct problems.
1. web app auto restart with given time delta (which I am not getting all the point of what you want to achieve).
2. data processing with pandas, some function misusage(which I need a real formatted python code script and the input data to solve the problem).
Hoping to get the first job on the freelancer. If not, hope other guys give u a clean and elegant solution.