boto3-refresh-session 0.0.18__tar.gz → 0.0.21__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: boto3-refresh-session
3
- Version: 0.0.18
3
+ Version: 0.0.21
4
4
  Summary: A simple Python package for refreshing boto3 sessions automatically.
5
5
  Home-page: https://github.com/michaelthomasletts/boto3-refresh-session
6
6
  License: MIT
@@ -73,7 +73,10 @@ To use this package, your machine must be configured with AWS
73
73
  credentials. To learn more about how `boto3` searches for credentials on a
74
74
  machine, check [this documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html).
75
75
 
76
- ```
76
+ ```python
77
+ from boto3_refresh_session import AutoRefreshableSession
78
+
79
+
77
80
  sess = AutoRefreshableSession(
78
81
  region="<your-region>",
79
82
  role_arn="<your-role-arn>",
@@ -82,6 +85,12 @@ sess = AutoRefreshableSession(
82
85
  s3_client = sess.session.client(service_name="s3")
83
86
  ```
84
87
 
88
+ ### Installation
89
+
90
+ ```bash
91
+ pip install boto3-refresh-session
92
+ ```
93
+
85
94
  ### Authors
86
95
 
87
96
  - [Michael Letts](https://michaelthomasletts.github.io/)
@@ -48,7 +48,10 @@ To use this package, your machine must be configured with AWS
48
48
  credentials. To learn more about how `boto3` searches for credentials on a
49
49
  machine, check [this documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html).
50
50
 
51
- ```
51
+ ```python
52
+ from boto3_refresh_session import AutoRefreshableSession
53
+
54
+
52
55
  sess = AutoRefreshableSession(
53
56
  region="<your-region>",
54
57
  role_arn="<your-role-arn>",
@@ -57,6 +60,12 @@ sess = AutoRefreshableSession(
57
60
  s3_client = sess.session.client(service_name="s3")
58
61
  ```
59
62
 
63
+ ### Installation
64
+
65
+ ```bash
66
+ pip install boto3-refresh-session
67
+ ```
68
+
60
69
  ### Authors
61
70
 
62
71
  - [Michael Letts](https://michaelthomasletts.github.io/)
@@ -1,19 +1,20 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  __doc__ = """
4
- Helper method for generating an automatically refreshing ``boto3.Session``
4
+ Helper method for generating an automatically refreshing :class:`boto3.session.Session`
5
5
  object.
6
6
 
7
7
  .. warning::
8
8
  ``AutoRefreshableSession`` was not tested for manually passing hard-coded
9
- account credentials to the ``boto3.Session`` or ``boto3.Session.client``
9
+ account credentials to the :class:`boto3.session.Session` or ``boto3.client``
10
10
  objects! There are optional ``session_kwargs`` and ``client_kwargs``
11
11
  parameters available for passing hard-coded account credentials, which
12
12
  should work; however, that cannot be guaranteed! In any case, the ``boto3``
13
- documentation strongly urges against passing hard-coded account credentials
13
+ documentation generally recommends against passing hard-coded account credentials
14
14
  as parameters; it is for that reason the documentation below, and everywhere
15
15
  else, only mentions ``~/.aws/config`` and ``~/.aws/credentials`` for
16
- authorization.
16
+ authorization. Since the ``session_kwargs`` and ``client_kwargs`` parameters
17
+ were not tested, you will need to use those parameters at your own discretion.
17
18
  """
18
19
  __all__ = ["AutoRefreshableSession"]
19
20
 
@@ -28,14 +29,11 @@ from botocore.session import get_session
28
29
 
29
30
  @define
30
31
  class AutoRefreshableSession:
31
- """Returns a ``boto3.Session`` object which refreshes automatically, no extra
32
+ """Returns a :class:`boto3.session.Session` object which refreshes automatically, no extra
32
33
  steps required.
33
34
 
34
35
  This object is useful for long-running processes where temporary credentials
35
- may expire between iterations.
36
-
37
- To use this class, you must have ``~/.aws/config`` or ``~/.aws/credentials``
38
- configured on your machine.
36
+ may expire.
39
37
 
40
38
  Parameters
41
39
  ----------
@@ -48,27 +46,24 @@ class AutoRefreshableSession:
48
46
  ttl : int, optional
49
47
  Number of seconds until temporary credentials expire, default 900.
50
48
  session_kwargs : dict, optional
51
- Optional keyword arguments for ``boto3.Session``.
49
+ Optional keyword arguments for :class:`boto3.session.Session`.
52
50
  client_kwargs : dict, optional
53
- Optional keyword arguments for ``boto3.Session.client``.
51
+ Optional keyword arguments for ``boto3.client``.
54
52
 
55
53
  Attributes
56
54
  ----------
57
55
  session
58
- Returns a ``boto3.Session`` object with credentials which refresh
56
+ Returns a :class:`boto3.session.Session` object with credentials which refresh
59
57
  automatically.
60
58
 
61
59
  Notes
62
60
  -----
63
- boto3 employs a variety of methods (in order) to identify credentials:
64
-
65
- https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
66
-
67
- This class assumes that ``~/.aws`` exists with ``/config`` or ``/credentials``!
61
+ Check the :ref:`authorization documentation <authorization>` for additional
62
+ information concerning how to authorize access to AWS.
68
63
 
69
64
  Examples
70
65
  --------
71
- Here's how to initialize the ``boto3.Client.S3`` object:
66
+ Here's how to initialize this object:
72
67
 
73
68
  >>> sess = AutoRefreshableSession(
74
69
  >>> region="us-east-1",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "boto3-refresh-session"
3
- version = "0.0.18"
3
+ version = "0.0.21"
4
4
  description = "A simple Python package for refreshing boto3 sessions automatically."
5
5
  authors = [
6
6
  {name = "Mike Letts",email = "michaelthomasletts@gmail.com"}