Skip to main content
Question

Box API call from AWS Lambda using python sdk

  • May 22, 2025
  • 2 replies
  • 53 views

Forum|alt.badge.img

Hi,

I'm trying to get box users information from aws lambda. However, I've been getting an error, and not sure what to do since I don't have much knowledge on this. Following is the code:

from boxsdk import JWTAuth
from boxsdk import Client
import boto3
import os

def lambda_handler(event, context):
*******
*******
*******
*******
*******
print(lst)
auth = JWTAuth.from_settings_file('/tmp/config.json')
access_token = auth.authenticate_instance()
client = Client(auth)
users = client.users(user_type='all')
  for user in users:
if user.login =="demo_user_login":
    print(user.id)
  

error:BOX1_abQed0iJ9GPdicTCyAQZmg.png

I have installed boxsdk, boxsdk[jwt] in the directory. If anyone could help with would be great and appreciable. Please let me know if any clarification is needed.

Thank you!

2 replies

Forum|alt.badge.img

HI 

I think this is a python issue mainly. Maybe check these articles where other users have run into similar issues

https://stackoverflow.com/questions/57189352/aws-lambda-unable-to-import-module-python-handler-no-module-named-cffi-bac

https://stackoverflow.com/questions/57437564/how-to-fix-import-error-no-module-named-cffi-backend-when-import-pysftp-fr

Rgds

Peter Christensen, Platform Solutions Engineer, Box


Forum|alt.badge.img

Hi Mr. Christensen,

Thank you so much. Appreciate it!

Edit:

Was able to fix it. Sincerely appreciate your help.