Releases: box/box-python-sdk
v2.6.0
v.2.5.0
v2.4.1
v2.3.2
v2.3.0
- Added the ability to set file description upon upload
- Added support for basic authenticated proxy and unauthenticated proxy
v2.2.2
v2.2.1
v2.2.0
- Added abilty for user to retrieve an avatar for a user.
- Changed retry strategy to use exponential backoff with randomized jitter.
v2.1.0
- Added ability for user to chunk upload files and resume uploads for interrupted uploads.
- Added ability to verify webhook message
- Added ability for user to add metadata classification to files and folders.
- Bugfix where calling
.response_object()method on an API object could throw.
v2.0.0
Breaking Changes
-
Python 2.6 is no longer supported.
-
Python 3.3 is no longer supported.
-
client.search()now returns aSearchobject that exposes aquery()method to call the Search API.
Useclient.search().query(**search_params)instead ofclient.search(**search_params). -
client.get_memberships(...)has a change in signature. The limit and offset parameters have swapped positions to keep
consistency with the rest of the SDK. -
client.groups(...)has been changed toclient.get_groups. The limit and offset parameters have swapped positions. -
The
unshared_atparameter foritem.create_shared_link(...)andfile.get_shared_link_download_url(...)
now takes anRFC3339-formatted <https://tools.ietf.org/html/rfc3339#section-5.8>unicodestring instead of a
datetime.date. Users migrating from v1.x can pass the value ofdate.isoformat()instead of thedate
object itself. -
Events.get_events(...)now returns a list ofEventinstances rather than a list ofdict
representing events.Eventinherits fromMappingbut will not have all the same capabilities as
dict.-
Your code is affected if you use
Events.get_events(...)and expect a list ofdictrather than a list of
Mapping. For example, if you use__setitem__(event['key'] = value),update(),copy(), or
if your code depends on thestrorreprof theEvent. Use of__getitem__(event['key']),
get(), and otherMappingmethods is unaffected. See
https://docs.python.org/2.7/library/collections.html#collections-abstract-base-classes for methods supported on
Mappinginstances. -
Migration: If you still need to treat an
Eventas adict, you can get a deepcopy of the originaldict
using the new property onBaseAPIJSONObject,response_object.
-
-
LoggingNetworkhas been removed. Logging calls are now made from theDefaultNetworkclass. In addition,
the logging format strings in this class have changed in a way that
will break logging for any applications that have overridden any of these
strings. They now use keyword format placeholders instead of positional
placeholders. All custom format strings will now have to use the same keyword
format placeholders. Though this is a breaking change, the good news is that
using keyword format placeholders means that any future changes will be
automatically backwards-compatibile (as long as there aren't any changes to
change/remove any of the keywords). -
File.update_contents()andFile.update_contents_with_stream()now
correctly return aFileobject with the correct internal JSON structure.
Previously it would return aFileobject where the file JSON is hidden
insidefile['entries'][0]. This is a bugfix, but will be a breaking
change for any clients that have already written code to handle the bug. -
Comparing two objects (e.g. a
Fileand aFolder) that have the same Box ID but different types with==
will now correctly returnFalse. -
The following methods now return iterators over the entire collection of returned objects, rather than
a single page:client.users()client.groups()client.search().query()folder.get_items()
Since
folder.get_items()now returns an iterator,folder.get_items_limit_offset()and
folder.get_items_marker()have been removed. To use marker based paging withfolder.get_items(),
pass theuse_marker=Trueparameter and optionally specify amarkerparameter to begin paging from that
point in the collection.Additionally,
group.membership()has been renamed togroup.get_memberships(), and returns an iterator of
membership objects. This method no longer provides the option to return tuples with paging information. -
The
Translatorclass has been reworked;translator.get(...)still returns the constructor for the object class
corresponding to the passed in type, buttranslator.translate(...)now takes aSessionand response object
directly and produces the translated object. This method will also translate any nested objects found.- This change obviates the need for
GroupMembershipto have a custom constructor; it now uses the default
BaseObjectconstructor.
- This change obviates the need for
Features
-
All publicly documented API endpoints and parameters should now be supported by the SDK
-
Added more flexibility to the object translation system:
- Can create non-global
Translatorinstances, which can extend or
not-extend the global defaultTranslator. - Can initialize
BoxSessionwith a customTranslator. - Can register custom subclasses on the
Translatorwhich is associated
with aBoxSessionor aClient. - All translation of API responses now use the
Translatorthat is
referenced by theBoxSession, instead of directly using the global
defaultTranslator. - Nested objects are now translated by
translator.translate()
- Can create non-global
-
When the
auto_session_renewalisTruewhen calling any of the request
methods onBoxSession, if there is no access token,BoxSessionwill
renew the token before making the request. This saves an API call. -
Auth objects can now be closed, which prevents them from being used to
request new tokens. This will also revoke any existing tokens (though that
feature can be disabled by passingrevoke=False). Also introduces a
closing()context manager method, which will auto-close the auth object
on exit. -
Various enhancements to the
JWTAuthbaseclass:- The
authenticate_app_user()method is renamed to
authenticate_user(), to reflect that it may now be used to authenticate
managed users as well. See the method docstring for details.
authenticate_app_user()is now an alias ofauthenticate_user(), in
order to not introduce an unnecessary backwards-incompatibility. - The
userargument toauthenticate_user()may now be either a user
ID string or aUserinstance. Before it had to be aUserinstance. - The constructor now accepts an optional
userkeyword argument, which
may be a user ID string or aUserinstance. When this is passed,
authenticate_user()and can be called without passing a value for the
userargument. More importantly, this means thatrefresh()can be
called immediately after construction, with no need for a manual call to
authenticate_user(). Combined with the aforementioned improvement to
theauto_session_renewalfunctionality ofBoxSession, this means
that authentication forJWTAuthobjects can be done completely
automatically, at the time of first API call. - The constructor now supports passing the RSA private key in two different
ways: by file system path (existing functionality), or by passing the key
data directly (new functionality). Thersa_private_key_file_sys_path
parameter is now optional, but it is required to pass exactly one of
rsa_private_key_file_sys_pathorrsa_private_key_data. - Document that the
enterprise_idargument toJWTAuthis allowed to
beNone. authenticate_instance()now accepts anenterpriseargument, which
can be used to set and authenticate as the enterprise service account user,
ifNonewas passed forenterprise_idat construction time.- Authentications that fail due to the expiration time not falling within the
correct window of time are now automatically retried using the time given
in the Date header of the Box API response. This can happen naturally when
the system time of the machine running the Box SDK doesn't agree with the
system time of the Box API servers.
- The
-
Added an
Eventclass. -
Moved
metadata()method toItemso it's now available forFolder
as well asFile. -
The
BaseAPIJSONObjectbaseclass (which is a superclass of all API
response objects) now supports__contains__and__iter__. They behave
the same as forMapping. That is,__contains__checks for JSON keys
in the object, and__iter__yields all of the object's keys. -
Added a
RecentItemclass. -
Added
client.get_recent_items()to retrieve a user's recently accessed items on Box. -
Added support for the
can_view_pathparameter when creating new collaborations. -
Added
BoxObjectCollectionand subclassesLimitOffsetBasedObjectCollectionand
MarkerBasedObjectCollectionto more easily manage paging of objects from an endpoint.
These classes manage the logic of constructing requests to an endpoint and storing the results,
then provide__next__to easily iterate over the results. The option to return results one
by one or as aPageof results is also provided. -
Added a
downscope_token()method to theClientclass. This generates a token that
has its permissions reduced to the provided scopes and for the optionally provided
FileorFolder. -
Added methods for configuring
JWTAuthfrom config file:JWTAuth.from_settings_fileand
JWTAuth.from_settings_dictionary. -
Added
network_responseproperty toBoxOAuthException. -
API Configuration can now be done per
BoxSessioninstance.
Other
- Added extra information to
BoxAPIException. - Added
collaboration()method toClient. - Reworked the class hierarchy. Previously,
BaseEndpointwas the parent ofBaseObjectwhich was the parent
of all smart objects. NowBaseObjectis a child of bothBaseEndpointandBaseAPIJSONObject.
``Ba...