)]}'
{
  "commit": "ec2fb18e7f0f452fb20e43fd0bfbb788bcf7f46b",
  "tree": "b093f3dd59c20c834da46e694b7bbca64ad7d9cb",
  "parents": [
    "63ac08afe44c3da51a6fb3bfc2fcdb6588e040ef"
  ],
  "author": {
    "name": "bojeil-google",
    "email": "bojeil-google@users.noreply.github.com",
    "time": "Thu Jul 22 10:01:31 2021 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Jul 22 13:01:31 2021 -0400"
  },
  "message": "feat: support refresh callable on google.oauth2.credentials.Credentials (#812)\n\nThis is an optional parameter that can be set via the constructor.\r\nIt is used to provide the credentials with new tokens and their\r\nexpiration time on `refresh()` call.\r\n\r\n```\r\ndef refresh_handler(request, scopes):\r\n    # Generate a new token for the requested scopes by calling\r\n    # an external process.\r\n    return (\r\n        \"ACCESS_TOKEN\",\r\n        _helpers.utcnow() + datetime.timedelta(seconds\u003d3600))\r\n\r\ncreds \u003d google.oauth2.credentials.Credentials(\r\n    scopes\u003dscopes,\r\n    refresh_handler\u003drefresh_handler)\r\ncreds.refresh(request)\r\n```\r\n\r\nIt is useful in the following cases:\r\n- Useful in general when tokens are obtained by calling some\r\n  external process on demand.\r\n- Useful in particular for retrieving downscoped tokens from a\r\n  token broker.\r\n\r\nThis should have no impact on existing behavior. Refresh tokens\r\nwill still have higher priority over refresh handlers.\r\n\r\nA getter and setter is exposed to make it easy to set the callable\r\non unpickled credentials as the callable may not be easily serialized.\r\n\r\n```\r\nunpickled \u003d pickle.loads(pickle.dumps(oauth_creds))\r\nunpickled.refresh_handler \u003d refresh_handler\r\n```",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "dcfa5f91222dee01e4ee330ed4c62803a020b867",
      "old_mode": 33188,
      "old_path": "google/oauth2/credentials.py",
      "new_id": "158249ed5f60379029921899a7bb468b31261563",
      "new_mode": 33188,
      "new_path": "google/oauth2/credentials.py"
    },
    {
      "type": "modify",
      "old_id": "4a387a58e068fc398e8f40cf7e0b483fa9bbf46f",
      "old_mode": 33188,
      "old_path": "tests/oauth2/test_credentials.py",
      "new_id": "4a7f66e7f495312aea397864c9e0378f821fb066",
      "new_mode": 33188,
      "new_path": "tests/oauth2/test_credentials.py"
    }
  ]
}
