Releases: box/box-python-sdk
Releases · box/box-python-sdk
Version 2.0.0a4
Breaking Changes
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.
- Your code is affected if you use
- The logging format strings in
LoggingNetworkhave 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).
Features
- 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.
- 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. - 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. - 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.
- 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.
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.
BaseObjectis the parent of all objects that are a part of the REST API. Another subclass of
BaseAPIJSONObject,APIJSONObject, was created to represent pseudo-smart objects such asEventthat are not
directly accessible through an API endpoint. - Added
network_response_constructoras an optional property on the
Networkinterface. Implementations are encouraged to override this
property, and use it to constructNetworkResponseinstances. That way,
subclass implementations can easily extend the functionality of the
NetworkResponse, by re-overriding this property. This property is defined
and used in theDefaultNetworkimplementation. - Move response logging to a new
LoggingNetworkResponseclass (which is
made possible by the aforementionednetwork_response_constructor
property). Now the SDK decides whether to log the response body, based on
whether the caller reads or streams the content. - Add more information to the request/response logs from
LoggingNetwork. - Add logging for request exceptions in
LoggingNetwork. - Fixed an exception that was being raised from
ExtendableEnumMeta.__dir__(). - CPython 3.6 support.
Version 2.0.0a3
Breaking Changes
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.
- Your code is affected if you use
- The logging format strings in
LoggingNetworkhave 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).
Features
- 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.
- 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. - 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. - 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.
- The
- Added an
Eventclass. - Moved
metadata()method toItemso it's now available forFolder
as well asFile.
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.
BaseObjectis the parent of all objects that are a part of the REST API. Another subclass of
BaseAPIJSONObject,APIJSONObject, was created to represent pseudo-smart objects such asEventthat are not
directly accessible through an API endpoint. - Added
network_response_constructoras an optional property on the
Networkinterface. Implementations are encouraged to override this
property, and use it to constructNetworkResponseinstances. That way,
subclass implementations can easily extend the functionality of the
NetworkResponse, by re-overriding this property. This property is defined
and used in theDefaultNetworkimplementation. - Move response logging to a new
LoggingNetworkResponseclass (which is
made possible by the aforementionednetwork_response_constructor
property). Now the SDK decides whether to log the response body, based on
whether the caller reads or streams the content. - Add more information to the request/response logs from
LoggingNetwork. - Add logging for request exceptions in
LoggingNetwork. - Fixed an exception that was being raised from
ExtendableEnumMeta.__dir__(). - CPython 3.6 support.
Version 2.0.0a2
Breaking Changes
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.
- Your code is affected if you use
Features
- 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.
- Can create non-global
- Added an
Eventclass.
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.
BaseObjectis the parent of all objects that are a part of the REST API. Another subclass of
BaseAPIJSONObject,APIJSONObject, was created to represent pseudo-smart objects such asEventthat are not
directly accessible through an API endpoint. - Fixed an exception that was being raised from
ExtendableEnumMeta.__dir__().
Version 2.0.0a1
Breaking Changes
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.
- Your code is affected if you use
Features
- Added ability to create custom subclasses of SDK objects with
_item_typedefined. - Added an
Eventclass.
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.
BaseObjectis the parent of all objects that are a part of the REST API. Another subclass of
BaseAPIJSONObject,APIJSONObject, was created to represent pseudo-smart objects such asEventthat are not
directly accessible through an API endpoint.
Version 1.5.3
- Bugfix so that
JWTAuthopens the PEM private key file in'rb'mode.
Version 1.5.2
- Bugfix so that
OAuth2always has the correct tokens after a call torefresh().
Version 1.5.1
- Added a
revoke()method to theOAuth2class. Calling it will revoke the current access/refresh token pair.
Version 1.5.0
Merge pull request #121 from Jeff-Meadows/docs Docs
Version 1.4.2
-
Make sure that
__all__is only defined once, as a list ofstr. Some
programs (e.g. PyInstaller) naively parse init.py files, and if
__all__is defined twice, the second one will be ignored. This can cause
__all__to appear as a list ofunicodeon Python 2. -
Create wheel with correct conditional dependencies and license file.
-
Change the
licensemeta-data from the full license text, to just a short
string, as specified in [1][2].[1] https://docs.python.org/3.5/distutils/setupscript.html#additional-meta-data
-
Include entire test/ directory in source distribution. test/init.py was
previously missing. -
Update documentation.
Version 1.4.1
Merge pull request #114 from Jeff-Meadows/slinkurl Expose file.get_shared_link_download_url method.