Skip to main content
Question

upload files with python

  • May 22, 2025
  • 2 replies
  • 61 views

Forum|alt.badge.img

I am writing a simple python script to upload .zip file weekly and to overwrite the existing one...

I see that the first step of the boxsdk is to enter client id, secrete and token. but the token says it will expire every 60 minutes... how can I hardcode parameters into my script so my access does not expire? 

2 replies

Forum|alt.badge.img

Hello , 

 

Thanks so much for using our platform and development forum! 

 

For security reasons, it is not possible to hard code parameters so these do not expire. Your code should be able to handle the token refresh once the hour is up and I believe the python SDK should already have logic for this. 

 

Best, 

Kourtney


Forum|alt.badge.img

 For this type of use case where you want your script to run without user interaction, we would recommend using Server-to-Server authentication with JWT, rather than traditional OAuth2.  The Box Python SDK has a boxsdk[jwt] variant that supports JWT auth, and there are some general instructions for how to get set up using the SDK with JWT authentication in the Developer Quickstart Guide.