heroku 我收到“请求相关性警告:urllib 3(1.25.3)或chardet(3.0.4)与支持的版本不匹配!”

mu0hgdu0  于 2022-11-24  发布在  其他
关注(0)|答案(1)|浏览(176)

我正在尝试下载youtube视频并上传到电报

def start_callback(bot, update, args):
    if len(args)==1:
        search="https://www.youtube.com/results?search_query="+args[0]
    else:
        search="https://www.youtube.com/results?search_query="+("+".join(args))
        print
    response = requests.get(search)
    page = response.text
    soup = BeautifulSoup(page,"lxml")
    links=[]
    for i in soup.find_all("a",{"aria-hidden":"true"}):
        links.append("https://www.youtube.com"+i.attrs['href'])

    for i in links[:10]:
        update.message.reply_text(i)
        #bot.send_message(chat_id="@marks_channel", text=i)
        sleep(1)
    update.message.reply_text("top 10 youtube videos for the "+" ".join(args))

然后

start_handler = CommandHandler('ytsearch',start_callback, pass_args=True)
dispatcher.add_handler(start_handler)

当我在本地执行它时一切正常,但是,当我将它部署到Heroku时,我收到以下警告:云应用平台。
请求相关性警告:urllib 3(1.25.3)或chardet(3.0.4)与支持的版本不匹配!
我已经尝试更新requests,但它没有改变任何东西。
我也尝试了RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) doesn't match a supported version,但Heroku没有变化。
请帮助:/

vuktfyat

vuktfyat1#

我通过使用pip手动更新requests包修复了这个问题:

pip install --upgrade requests

相关问题