Skip to main content
Question

AttributeError: 'Client' object has no attribute 'get_retention_policies'

  • May 22, 2025
  • 4 replies
  • 30 views

Forum|alt.badge.img

Hello Box Gurus,

 

Trying to extract retention policies. But getting an error.  Is my API endpoint correct ?

 

sdk = JWTAuth(
client_id="myclientid",
client_secret="myclientsecret",
enterprise_id="12345",
jwt_key_id="myjwtkeyid",
rsa_private_key_file_sys_path="myprivate.pem",
)

client = Client(sdk)
retention_policies = client.get_retention_policies()

 

AttributeError: 'Client' object has no attribute 'get_retention_policies'

4 replies

Forum|alt.badge.img

 It looks like you're using the Box Python SDK — what version are you on?  That method was only added in v2.0.0, which was recently released.


Forum|alt.badge.img

Awesome. That was it. Running an older version of sdk. Did a pip upgrade and error went away. I have a follow up question.

 

How do I access/iterate through this object ?

 

 

Thanks Again.


Forum|alt.badge.img

 The Python SDK docs have examples for how to use most of the functions of the SDK — please refer to those.  In general, for API endpoints that return a collection, the SDK returns an iterator that you can use in a for-in loop or manually advance by calling next() on it.


Forum|alt.badge.img

I did try to iterate, but it was giving me an error. After closer inspection, I found my authentication needs higher privileges. 

 

"error_description="The request requires higher privileges than provided by the access token."'

 

Thanks again for the quick response. Really appreciated.