From 3034cf8aabb074afc3f229416ecee6dcdc1e4de6 Mon Sep 17 00:00:00 2001 From: "DavidCrompton1192@gmail.com" Date: Fri, 17 Mar 2023 23:12:57 -0400 Subject: [PATCH] BuffIO to read PDF COntent --- handyhelper/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handyhelper/__init__.py b/handyhelper/__init__.py index 494d388..c0ea490 100644 --- a/handyhelper/__init__.py +++ b/handyhelper/__init__.py @@ -2,6 +2,7 @@ import nextcord as nc from nextcord.ext import commands from typing import Optional import asyncio +import io import os import requests as req from bs4 import BeautifulSoup as soup @@ -30,7 +31,7 @@ async def search(txt): async def getPDF(url): resp = req.get(url, stream=True) - pdf = resp.content + pdf = io.BytesIO(resp.content) pages = pdftotext.PDF(pdf) return "\n\n".join(pages)