File tree 3 files changed +36
-3
lines changed 3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -560,6 +560,39 @@ def load(self) -> List[Document]:
560
560
try :
561
561
# Import the Canvas class
562
562
from canvasapi import Canvas
563
+
564
+ # see: https://github.com/ucfopen/canvasapi/issues/687
565
+ from canvasapi .file import File
566
+
567
+ def patched_download (self , location ):
568
+ """
569
+ Download the file to specified location.
570
+
571
+ :param location: The path to download to.
572
+ :type location: str
573
+ """
574
+ response = self ._requester .request ("GET" , _url = self .url , use_auth = False )
575
+
576
+ with open (location , "wb" ) as file_out :
577
+ file_out .write (response .content )
578
+
579
+
580
+ def patched_get_contents (self , binary = False ):
581
+ """
582
+ Download the contents of this file.
583
+ Pass binary=True to return a bytes object instead of a str.
584
+
585
+ :rtype: str or bytes
586
+ """
587
+ response = self ._requester .request ("GET" , _url = self .url , use_auth = False )
588
+ if binary :
589
+ return response .content
590
+ else :
591
+ return response .text
592
+
593
+ File .get_contents = patched_get_contents
594
+ File .download = patched_download
595
+
563
596
from canvasapi .exceptions import CanvasException
564
597
except ImportError as exc :
565
598
raise ImportError (
Original file line number Diff line number Diff line change 1
1
langchain
2
2
langchain-community
3
3
unstructured [docx,pptx,xlsx ]
4
- canvasapi
4
+ canvasapi =3.3.0
5
5
beautifulsoup4
6
6
lxml
7
7
PyPDF2 [crypto ]
Original file line number Diff line number Diff line change 2
2
3
3
setup (
4
4
name = "canvas_langchain" ,
5
- version = "0.9.17 " ,
5
+ version = "0.9.18 " ,
6
6
description = "A canvas langchain integration" ,
7
7
long_description = open ("README.md" ).read (),
8
8
long_description_content_type = "text/markdown" ,
18
18
"langchain" ,
19
19
"langchain-community" ,
20
20
"unstructured[docx,pptx]" ,
21
- "canvasapi" ,
21
+ "canvasapi=3.3.0 " ,
22
22
"beautifulsoup4" ,
23
23
"lxml" ,
24
24
"PyPDF2[crypto]" ,
You can’t perform that action at this time.
0 commit comments