Skip to content

Releases: box/box-python-sdk

Version 2.0.0a3

23 Nov 22:54
Compare
Choose a tag to compare
Version 2.0.0a3 Pre-release
Pre-release

Breaking Changes

  • Events.get_events(...) now returns a list of Event instances rather than a list of dict
    representing events. Event inherits from Mapping but will not have all the same capabilities as
    dict.
    • Your code is affected if you use Events.get_events(...) and expect a list of dict rather than a list of
      Mapping. For example, if you use __setitem__ (event['key'] = value), update(), copy(), or
      if your code depends on the str or repr of the Event. Use of __getitem__ (event['key']),
      get(), and other Mapping 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 a dict, you can get a deepcopy of the original dict
      using the new property on BaseAPIJSONObject, response_object.
  • The logging format strings in LoggingNetwork 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).

Features

  • Added more flexibility to the object translation system:
    • Can create non-global Translator instances, which can extend or
      not-extend the global default Translator.
    • Can initialize BoxSession with a custom Translator.
    • Can register custom subclasses on the Translator which is associated
      with a BoxSession or a Client.
    • All translation of API responses now use the Translator that is
      referenced by the BoxSession, instead of directly using the global
      default Translator.
  • When the auto_session_renewal is True when calling any of the request
    methods on BoxSession, if there is no access token, BoxSession will
    renew the token before making the request. This saves an API call.
  • 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 of authenticate_user(), in
      order to not introduce an unnecessary backwards-incompatibility.
    • The user argument to authenticate_user() may now be either a user
      ID string or a User instance. Before it had to be a User instance.
    • The constructor now accepts an optional user keyword argument, which
      may be a user ID string or a User instance. When this is passed,
      authenticate_user() and can be called without passing a value for the
      user argument. More importantly, this means that refresh() can be
      called immediately after construction, with no need for a manual call to
      authenticate_user(). Combined with the aforementioned improvement to
      the auto_session_renewal functionality of BoxSession, this means
      that authentication for JWTAuth objects can be done completely
      automatically, at the time of first API call.
    • Document that the enterprise_id argument to JWTAuth is allowed to
      be None.
    • authenticate_instance() now accepts an enterprise argument, which
      can be used to set and authenticate as the enterprise service account user,
      if None was passed for enterprise_id at construction time.
  • Added an Event class.
  • Moved metadata() method to Item so it's now available for Folder
    as well as File.

Other

  • Added extra information to BoxAPIException.
  • Added collaboration() method to Client.
  • Reworked the class hierarchy. Previously, BaseEndpoint was the parent of BaseObject which was the parent
    of all smart objects. Now BaseObject is a child of both BaseEndpoint and BaseAPIJSONObject.
    BaseObject is 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 as Event that are not
    directly accessible through an API endpoint.
  • Added network_response_constructor as an optional property on the
    Network interface. Implementations are encouraged to override this
    property, and use it to construct NetworkResponse instances. That way,
    subclass implementations can easily extend the functionality of the
    NetworkResponse, by re-overriding this property. This property is defined
    and used in the DefaultNetwork implementation.
  • Move response logging to a new LoggingNetworkResponse class (which is
    made possible by the aforementioned network_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

03 Sep 01:03
Compare
Choose a tag to compare
Version 2.0.0a2 Pre-release
Pre-release

Breaking Changes

  • Events.get_events(...) now returns a list of Event instances rather than a list of dict
    representing events. Event inherits from Mapping but will not have all the same capabilities as
    dict.
    • Your code is affected if you use Events.get_events(...) and expect a list of dict rather than a list of
      Mapping. For example, if you use __setitem__ (event['key'] = value), update(), copy(), or
      if your code depends on the str or repr of the Event. Use of __getitem__ (event['key']),
      get(), and other Mapping 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 a dict, you can get a deepcopy of the original dict
      using the new property on BaseAPIJSONObject, response_object.

Features

  • Added more flexibility to the object translation system:
    • Can create non-global Translator instances, which can extend or
      not-extend the global default Translator.
    • Can initialize BoxSession with a custom Translator.
    • Can register custom subclasses on the Translator which is associated
      with a BoxSession or a Client.
    • All translation of API responses now use the Translator that is
      referenced by the BoxSession, instead of directly using the global
      default Translator.
  • Added an Event class.

Other

  • Added extra information to BoxAPIException.
  • Added collaboration() method to Client.
  • Reworked the class hierarchy. Previously, BaseEndpoint was the parent of BaseObject which was the parent
    of all smart objects. Now BaseObject is a child of both BaseEndpoint and BaseAPIJSONObject.
    BaseObject is 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 as Event that are not
    directly accessible through an API endpoint.
  • Fixed an exception that was being raised from ExtendableEnumMeta.__dir__().

Version 2.0.0a1

19 Aug 17:35
Compare
Choose a tag to compare
Version 2.0.0a1 Pre-release
Pre-release

Breaking Changes

  • Events.get_events(...) now returns a list of Event instances rather than a list of dict
    representing events. Event inherits from Mapping but will not have all the same capabilities as
    dict.
    • Your code is affected if you use Events.get_events(...) and expect a list of dict rather than a list of
      Mapping. For example, if you use __setitem__ (event['key'] = value), update(), copy(), or
      if your code depends on the str or repr of the Event. Use of __getitem__ (event['key']),
      get(), and other Mapping 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 a dict, you can get a deepcopy of the original dict
      using the new property on BaseAPIJSONObject, response_object.

Features

  • Added ability to create custom subclasses of SDK objects with _item_type defined.
  • Added an Event class.

Other

  • Added extra information to BoxAPIException.
  • Added collaboration() method to Client.
  • Reworked the class hierarchy. Previously, BaseEndpoint was the parent of BaseObject which was the parent
    of all smart objects. Now BaseObject is a child of both BaseEndpoint and BaseAPIJSONObject.
    BaseObject is 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 as Event that are not
    directly accessible through an API endpoint.

Version 1.5.3

26 May 20:40
Compare
Choose a tag to compare
  • Bugfix so that JWTAuth opens the PEM private key file in 'rb' mode.

Version 1.5.2

19 May 01:15
Compare
Choose a tag to compare
  • Bugfix so that OAuth2 always has the correct tokens after a call to refresh().

Version 1.5.1

19 May 01:17
Compare
Choose a tag to compare
  • Added a revoke() method to the OAuth2 class. Calling it will revoke the current access/refresh token pair.

Version 1.5.0

23 Mar 17:08
Compare
Choose a tag to compare
Merge pull request #121 from Jeff-Meadows/docs

Docs

Version 1.4.2

23 Feb 22:25
Compare
Choose a tag to compare
  • Make sure that __all__ is only defined once, as a list of str. 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 of unicode on Python 2.

  • Create wheel with correct conditional dependencies and license file.

  • Change the license meta-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

    [2] https://www.python.org/dev/peps/pep-0459/#license

  • Include entire test/ directory in source distribution. test/init.py was
    previously missing.

  • Update documentation.

Version 1.4.1

11 Feb 21:40
Compare
Choose a tag to compare
Merge pull request #114 from Jeff-Meadows/slinkurl

Expose file.get_shared_link_download_url method.

Version 1.4.0

05 Jan 19:47
Compare
Choose a tag to compare
Merge pull request #70 from box/jwt-key-rotation

Add 'kid' (jwt key id) to JWTAuth header