Releases: box/box-python-sdk
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 aSearch
object 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_at
parameter foritem.create_shared_link(...)
andfile.get_shared_link_download_url(...)
now takes anRFC3339-formatted <https://tools.ietf.org/html/rfc3339#section-5.8>
unicode
string 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 ofEvent
instances rather than a list ofdict
representing events.Event
inherits fromMapping
but will not have all the same capabilities as
dict
.-
Your code is affected if you use
Events.get_events(...)
and expect a list ofdict
rather than a list of
Mapping
. For example, if you use__setitem__
(event['key'] = value
),update()
,copy()
, or
if your code depends on thestr
orrepr
of theEvent
. Use of__getitem__
(event['key']
),
get()
, and otherMapping
methods is unaffected. See
https://docs.python.org/2.7/library/collections.html#collections-abstract-base-classes for methods supported on
Mapping
instances. -
Migration: If you still need to treat an
Event
as adict
, you can get a deepcopy of the originaldict
using the new property onBaseAPIJSONObject
,response_object
.
-
-
LoggingNetwork
has been removed. Logging calls are now made from theDefaultNetwork
class. 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 aFile
object with the correct internal JSON structure.
Previously it would return aFile
object 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
File
and 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=True
parameter and optionally specify amarker
parameter 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
Translator
class has been reworked;translator.get(...)
still returns the constructor for the object class
corresponding to the passed in type, buttranslator.translate(...)
now takes aSession
and response object
directly and produces the translated object. This method will also translate any nested objects found.- This change obviates the need for
GroupMembership
to have a custom constructor; it now uses the default
BaseObject
constructor.
- 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
Translator
instances, which can extend or
not-extend the global defaultTranslator
. - Can initialize
BoxSession
with a customTranslator
. - Can register custom subclasses on the
Translator
which is associated
with aBoxSession
or aClient
. - All translation of API responses now use the
Translator
that 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_renewal
isTrue
when calling any of the request
methods onBoxSession
, if there is no access token,BoxSession
will
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
JWTAuth
baseclass:- 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
user
argument toauthenticate_user()
may now be either a user
ID string or aUser
instance. Before it had to be aUser
instance. - The constructor now accepts an optional
user
keyword argument, which
may be a user ID string or aUser
instance. When this is passed,
authenticate_user()
and can be called without passing a value for the
user
argument. 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_renewal
functionality ofBoxSession
, this means
that authentication forJWTAuth
objects 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_path
orrsa_private_key_data
. - Document that the
enterprise_id
argument toJWTAuth
is allowed to
beNone
. authenticate_instance()
now accepts anenterprise
argument, which
can be used to set and authenticate as the enterprise service account user,
ifNone
was passed forenterprise_id
at 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
Event
class. -
Moved
metadata()
method toItem
so it's now available forFolder
as well asFile
. -
The
BaseAPIJSONObject
baseclass (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
RecentItem
class. -
Added
client.get_recent_items()
to retrieve a user's recently accessed items on Box. -
Added support for the
can_view_path
parameter when creating new collaborations. -
Added
BoxObjectCollection
and subclassesLimitOffsetBasedObjectCollection
and
MarkerBasedObjectCollection
to 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 aPage
of results is also provided. -
Added a
downscope_token()
method to theClient
class. This generates a token that
has its permissions reduced to the provided scopes and for the optionally provided
File
orFolder
. -
Added methods for configuring
JWTAuth
from config file:JWTAuth.from_settings_file
and
JWTAuth.from_settings_dictionary
. -
Added
network_response
property toBoxOAuthException
. -
API Configuration can now be done per
BoxSession
instance.
Other
- Added extra information to
BoxAPIException
. - Added
collaboration()
method toClient
. - Reworked the class hierarchy. Previously,
BaseEndpoint
was the parent ofBaseObject
which was the parent
of all smart objects. NowBaseObject
is a child of bothBaseEndpoint
andBaseAPIJSONObject
.
``Ba...
Version 2.0.0a12
v2.0.0a12 Fix pylint error in box session.
Version 2.0.0a11
v2.0.0a11 Automatically retry JWT auth API calls that fail because of the exp c…
Version 2.0.0a10
- (Breaking change) Removed the
downscope_token()
method from theOAuth2
class. - Added support for the
can_view_path
parameter when creating new collaborations. - Added a
downscope_token()
method to theClient
class. This generates a token that has its permissions reduced to the provided scopes and for the optionally providedFile
orFolder
. - Added methods for configuring
JWTAuth
from config file:JWTAuth.from_settings_file
andJWTAuth.from_settings_dictionary
. - Added
network_response
property toBoxOAuthException
.
Version 2.0.0a9
- Increased required minimum version of six to 1.9.0.
- Add
**kwargs
to JWTAuth constructor. Fixes #231. - Change
downscope_token()
to return aTokenResponse
object. (Breaking interface change from v2.0.0a8.)