-
Notifications
You must be signed in to change notification settings - Fork 97
Unable to upload file in AWS Lambda ? #174
Comments
I don't have any experience with that. I would assume that there are no issues as long as you can log into you SharePoint account from the Lambda server. |
I was able to execute the following lines of code on a local machine but failed to run AWS lambda from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
import shareplum
print(shareplum.__version__)
username = config['sp_user'] # user mail id
password = config['sp_password']
basepath = config['sp_base_path'] # 'https://xxxxxxx.sharepoint.com/'
sitename = config['sp_site_name'] # 'https://xxxxxxx.sharepoint.com/sites/xxxxxx'
dirname = 'testdir' # directory where file is suppose to upload
authcookie = Office365(basepath, username=username, password=password).GetCookies()
site = Site(sitename,version=Version.v365, authcookie=authcookie)
spfolder = site.Folder('Shared Documents/'+ dirname)
allfiles = spfolder.files
for file in allfiles:
print(file['Name'])
filename = '/tmp/'+ 'test-'+str(dateobj.date())+".csv"
#
with open(filename,'rb') as file_input:
print("Filename:",filename)
try:
#fileContent = file_input.read()
spfolder.upload_file(file_input, filename)
print("file uploaded")
except Exception as err:
print("\nERROR occurred: \n" + str(err)) Error
I'm able to get the list of files from the SharePoint location but I'm unable to upload the file using AWS Lambda. I'm using the following version of Layer in Lambda. |
I am currently fighting problems with using this code on Azure Functions. I found some problems with including the correct dependencies. It is important to double-check, as the requirements for the most current version can be found below. Just an idea. Regards certifi==2019.11.28 |
No description provided.
The text was updated successfully, but these errors were encountered: