D
D
dooble2020-03-24 04:13:02
Bots
dooble, 2020-03-24 04:13:02

Telegram parser bot not working on Heroku?

I uploaded the bot to heroku, all the necessary libraries were installed, but the function below does not want to run, although when the bot is launched on a PC, everything works fine, tell me what could be the problem?

def asos_parser_bot(linksJs, all_urls, headers, valuet, session, soup):
    goods = []
    conuntryList = ['RU', 'GB', 'AU', 'TW', 'HK', 'IL', 'CN', 'TR', 'DE', 'SE', 'FR', 'EE']
    for i in range(len(all_urls)):

        country = conuntryList[i]

        requestPrice = session.get(linksJs[i], headers=headers)
        soupJs = bs(requestPrice.content, 'lxml')
        soupJs = str(soupJs)
        root = etree.fromstring(soupJs)
        price = json.loads(root.xpath('.//p')[0].text)
        price = price[0]['productPrice']['current']['value']

        if i == 1:
            name = soup.find('h1').text
            goods.append({'name': name})

        goods.append({
            'country': country,
            'price': float(price),
            'valuet': valuet[i],
            'url': all_urls[i]
            })
    return goods


the code before and after this function also works properly on heroku, all libraries (except json) that are used in this function are used in others

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question