cuenca 2.0.0.dev4__py3-none-any.whl → 2.0.0.dev6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,6 +38,7 @@ __all__ = [
38
38
  'WalletTransaction',
39
39
  'Webhook',
40
40
  'WhatsappTransfer',
41
+ 'Jwt',
41
42
  ]
42
43
 
43
44
  from .accounts import Account
@@ -59,6 +60,7 @@ from .file_batches import FileBatch
59
60
  from .files import File
60
61
  from .identities import Identity
61
62
  from .identity_events import IdentityEvent
63
+ from .jwt import Jwt
62
64
  from .kyc_validations import KYCValidation
63
65
  from .kyc_verifications import KYCVerification
64
66
  from .limited_wallets import LimitedWallet
@@ -2,7 +2,7 @@ import datetime as dt
2
2
  from typing import ClassVar, Optional, cast
3
3
 
4
4
  from cuenca_validations.types import ApiKeyQuery, ApiKeyUpdateRequest
5
- from pydantic import ConfigDict
5
+ from pydantic import ConfigDict, SecretStr
6
6
 
7
7
  from ..http import Session, session as global_session
8
8
  from .base import Creatable, Queryable, Retrievable, Updateable
@@ -12,7 +12,7 @@ class ApiKey(Creatable, Queryable, Retrievable, Updateable):
12
12
  _resource: ClassVar = 'api_keys'
13
13
  _query_params: ClassVar = ApiKeyQuery
14
14
 
15
- secret: str
15
+ secret: SecretStr
16
16
  deactivated_at: Optional[dt.datetime] = None
17
17
  user_id: Optional[str] = None
18
18
  model_config = ConfigDict(
@@ -0,0 +1,12 @@
1
+ from typing import ClassVar
2
+
3
+ from pydantic import SecretStr
4
+
5
+ from .base import Creatable
6
+
7
+
8
+ class Jwt(Creatable):
9
+ _resource: ClassVar = 'jwt'
10
+
11
+ token: SecretStr
12
+ api_key: str
@@ -1,13 +1,19 @@
1
1
  from typing import ClassVar, cast
2
2
 
3
- from pydantic import ConfigDict
3
+ from pydantic import ConfigDict, SecretStr
4
4
 
5
5
  from ..http import Session, session as global_session
6
6
  from .base import Creatable
7
7
 
8
8
 
9
+ # mypy: disable-error-code=override
9
10
  class LoginToken(Creatable):
10
11
  _resource: ClassVar = 'login_tokens'
12
+
13
+ # Override the `id` field to be a `SecretStr`
14
+ # To ensure sensitive data is not exposed in logs.
15
+ id: SecretStr # type: ignore
16
+
11
17
  model_config = ConfigDict(
12
18
  json_schema_extra={'example': {'id': 'LTNEUInh69SuKXXmK95sROwQ'}}
13
19
  )
cuenca/resources/otps.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from typing import ClassVar, cast
2
2
 
3
- from pydantic import ConfigDict
3
+ from pydantic import ConfigDict, SecretStr
4
4
 
5
5
  from ..http import Session, session as global_session
6
6
  from .base import Creatable
@@ -8,7 +8,7 @@ from .base import Creatable
8
8
 
9
9
  class Otp(Creatable):
10
10
  _resource: ClassVar = 'otps'
11
- secret: str
11
+ secret: SecretStr
12
12
  model_config = ConfigDict(
13
13
  json_schema_extra={
14
14
  'example': {
@@ -2,16 +2,19 @@ import datetime as dt
2
2
  from typing import ClassVar, Optional, cast
3
3
 
4
4
  from cuenca_validations.types import AnyUrlString, SessionRequest, SessionType
5
- from pydantic import ConfigDict
5
+ from pydantic import ConfigDict, SecretStr
6
6
 
7
7
  from .. import http
8
8
  from .base import Creatable, Queryable, Retrievable
9
9
 
10
10
 
11
+ # mypy: disable-error-code=override
11
12
  class Session(Creatable, Retrievable, Queryable):
12
13
  _resource: ClassVar = 'sessions'
13
14
 
14
- id: str
15
+ # Override the `id` field to be a `SecretStr`
16
+ # To ensure sensitive data is not exposed in logs.
17
+ id: SecretStr = None # type: ignore
15
18
  created_at: dt.datetime
16
19
  user_id: str
17
20
  platform_id: str
cuenca/version.py CHANGED
@@ -1,3 +1,3 @@
1
- __version__ = '2.0.0.dev4'
1
+ __version__ = '2.0.0.dev6'
2
2
  CLIENT_VERSION = __version__
3
3
  API_VERSION = '2020-03-19'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: cuenca
3
- Version: 2.0.0.dev4
3
+ Version: 2.0.0.dev6
4
4
  Summary: Cuenca API Client
5
5
  Home-page: https://github.com/cuenca-mx/cuenca-python
6
6
  Author: Cuenca
@@ -16,7 +16,7 @@ Requires-Python: >=3.9
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: requests>=2.32.3
19
- Requires-Dist: cuenca-validations==2.0.0.dev12
19
+ Requires-Dist: cuenca-validations==2.0.0.dev13
20
20
  Requires-Dist: pydantic-extra-types>=2.10.1
21
21
  Dynamic: author
22
22
  Dynamic: author-email
@@ -2,12 +2,12 @@ cuenca/__init__.py,sha256=vFLEaVgT93FvqGtuoGyMFd_mQLABRm6T7zIcTZSMKjc,1807
2
2
  cuenca/exc.py,sha256=r_lL03-JS0AsXw71wuNbiwNYLHNDagM56tRxpYyK6Lw,601
3
3
  cuenca/jwt.py,sha256=plB2ttHPZnL0xq3gqubw_Jjtj1QYG2E5bk99N3cn5zg,1502
4
4
  cuenca/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- cuenca/version.py,sha256=dxKiyRP0ZG6SF9uTP9FWumTJBCMbMgPX3ZsElq2JC-A,83
5
+ cuenca/version.py,sha256=T7aA04XmWVM_d2TZX-lpCJcfyG8CapgGY1QrV64cqZw,83
6
6
  cuenca/http/__init__.py,sha256=V5TG6Ro9d3VY7umzcbtanmvHlGkv-k71H0tqrdMyH-s,49
7
7
  cuenca/http/client.py,sha256=psXJiSgd3SUSJ5jwvhdBWsVMNadenG353BNVXdh7HMY,4168
8
- cuenca/resources/__init__.py,sha256=pySyBur3jnWA5yfHFuVZfdnk6nROj3BsLRy7vVWXFoc,3019
8
+ cuenca/resources/__init__.py,sha256=piQC6qwdZXtr7P9IBO4UYUCV3UImPms7bsMzcVINg_A,3051
9
9
  cuenca/resources/accounts.py,sha256=5yfNxAHpxWFosoR4WrPrDGpBCRkaQk98V-w0wCPPXqU,345
10
- cuenca/resources/api_keys.py,sha256=N4Ci2XWvlWn9jyaGulPuDdZtFR5bMsz7fczlaqW6y0Y,2627
10
+ cuenca/resources/api_keys.py,sha256=NMcirjUYz5bwlVrPhnO1m1ctyrZNn_FRwkHjyZO9L1k,2644
11
11
  cuenca/resources/arpc.py,sha256=VymgjCNvsKWcozwQ1an4OHMmuRslBoSdxYqjvw2VAi4,1791
12
12
  cuenca/resources/balance_entries.py,sha256=c2p9nXrKpMJ2xlQkTLP_ttycb1RitA979mP46mbZnEc,1073
13
13
  cuenca/resources/base.py,sha256=P8papD4TscAf-v6sFnnzTMf-ZJLe7xIakgvqCvmN2Pk,5803
@@ -26,17 +26,18 @@ cuenca/resources/file_batches.py,sha256=-lTG1zfLMEZBaL75COlW-yL6zVvK2LMp6KzBuKAp
26
26
  cuenca/resources/files.py,sha256=SLPFVaqbQn3bF2p05FU3yDojyagxCCX6CvqHumeoorI,1948
27
27
  cuenca/resources/identities.py,sha256=wW8jbOQyWipmTwPgJ2ZEQVdOvNv3Y6dcuLHbMyyqjRg,1102
28
28
  cuenca/resources/identity_events.py,sha256=K1G6IEGlw6n482nZhBo_CJNBdpKFCO6duMQr5y9k4x8,374
29
+ cuenca/resources/jwt.py,sha256=AZvU2sWefuQJLUK5yrbaX8L8WaFaz6acppne9zsnLTg,184
29
30
  cuenca/resources/kyc_validations.py,sha256=HxafdK3atx8YOXkVaX_mAVwveoaJ5J0iTrIe6TMgpfI,1372
30
31
  cuenca/resources/kyc_verifications.py,sha256=vy8kB5hEAlOJeecb8NSlf0eS-v905tJauaAKI2yzDto,1638
31
32
  cuenca/resources/limited_wallets.py,sha256=m4uFRY4y_CetCbk1R49Rq2lAx1BvDqakAkFMWTS7AYs,1076
32
- cuenca/resources/login_tokens.py,sha256=aWGoiM80NIvMYdEhHvX0JqFzqhfWXMfQJZFGNbugluk,693
33
- cuenca/resources/otps.py,sha256=buqQp5l6rW23vmUdhmP-ntwYKK-uSR7bw3WVaYUhn4E,636
33
+ cuenca/resources/login_tokens.py,sha256=L3kosdQ7jelHJDGm9fAUp7Zf_r6BUTqChSMK8LX67kQ,881
34
+ cuenca/resources/otps.py,sha256=h8tU5P1i5wblI9XjjdRJCbsNDkZMp51DFpBJK_obyZU,653
34
35
  cuenca/resources/platforms.py,sha256=w-pOGZm4gTLf-exoF2kAOVidUy1Fgf_ZT-8WuP3T7Fs,2616
35
36
  cuenca/resources/questionnaires.py,sha256=csrVXIuWMmL140EyG5Xlukgangf7tytXEB3JepeE0LA,1094
36
37
  cuenca/resources/resources.py,sha256=nlsqp6a2DrhBCzgi7_flAvrfZScKfClHqEYKbV1FdHg,955
37
38
  cuenca/resources/savings.py,sha256=iGREHJ58Ak0O49P9Clw_jCPUbJc3TUW9P8E2JB_Gg3c,1481
38
39
  cuenca/resources/service_providers.py,sha256=x-FNcyiUkdUsNCGudyLGYDbRkD2jPj8-T8U3IumxTVQ,310
39
- cuenca/resources/sessions.py,sha256=TTkikbplO8H__sHDgCZEah5q_tkn76tjh3Sfyny5j_8,1696
40
+ cuenca/resources/sessions.py,sha256=RhZOVxvRNR9Hnuu5-ggR6m03-APNcQzCXLybAHNKsb8,1877
40
41
  cuenca/resources/statements.py,sha256=PqMvhoE9cvBneXjaS7w4JnTzYdDakkCkbdNYrd7b8LI,282
41
42
  cuenca/resources/transfers.py,sha256=bl2GWb9mkrCARe8-WIm00pZafcrVqbf3_C0cPlVU89Q,3276
42
43
  cuenca/resources/user_credentials.py,sha256=wnAGaB98h5nGdyMFHJYvxAQer6sleO2YPyYC--dE9V8,1276
@@ -57,7 +58,7 @@ tests/http/conftest.py,sha256=TnVfv_s0eXC55HSJQotxIqV2Rl2WbgNt5Ow6z-ZOjZE,177
57
58
  tests/http/test_client.py,sha256=y0dhBDG4ZKbIvN_TENFGT920mzxwI535imQ99UuqgC0,2594
58
59
  tests/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
60
  tests/resources/test_accounts.py,sha256=q7dD3k9Qj4qnl9v3aXmYSw6ShkLKD2W9FViFU_6VFeY,313
60
- tests/resources/test_api_keys.py,sha256=Cui7nmJAqFL6yScuObj5Fpjt_ecGnpb29JIdPhbdqIs,2281
61
+ tests/resources/test_api_keys.py,sha256=eUwX6ixffFd_WAaevQk1Sr0r2lCHs-NkLKaoY2OsxrE,2300
61
62
  tests/resources/test_arpc.py,sha256=4lRd8fO5vf8rvoh1V8Rw9qjw__fdZCeIh4IEYlU0k5o,489
62
63
  tests/resources/test_balance_entries.py,sha256=myoHpr3XSef_smUijS60EXW7YHcmr6m9b6B_BVW-JtY,643
63
64
  tests/resources/test_bill_payments.py,sha256=TnvrTPtCPOvKPGC5G1zI0fng3HXyTdKegCOvoYDHc9s,340
@@ -78,14 +79,14 @@ tests/resources/test_identity_events.py,sha256=BZlM2RXKtCORdTDQCemY3NAR3KWb3mPNq
78
79
  tests/resources/test_kyc_validations.py,sha256=TEyS6encW-InRpcAR4nDCfmkqqnn8yMC9AaS3iWm8Xw,420
79
80
  tests/resources/test_kyc_verifications.py,sha256=Y-ZU61o18I_3NFqMN2w4WGZTzwsIhULAtESqIXiizUY,634
80
81
  tests/resources/test_limited_wallets.py,sha256=c0zDDOip3lJk8chbcGr_nWCdkO9yuL_HbD1IikR5jH4,527
81
- tests/resources/test_login_tokens.py,sha256=kn0gXFOanIXjgKjbeOzfNyKsGAUkc2iKnuVmzIRaMD8,572
82
- tests/resources/test_otps.py,sha256=IpCczDNRL_WaWwc1rYbSRmtWMR7GMa-Pfbq2TZcZQDw,616
82
+ tests/resources/test_login_tokens.py,sha256=zXX3UkiyeL_K_BN3FaxuD5BUUOdNRbXUMJ-cCDpKQK4,591
83
+ tests/resources/test_otps.py,sha256=2Yw6i-wfrnLmTn1O69sVVrpWNEfBAeKbPIVmupIqgxE,635
83
84
  tests/resources/test_platforms.py,sha256=5b6-XC3uAz8GARFkFoanH62jxE1uJIMXcdpeUhmI8Kg,211
84
85
  tests/resources/test_questionnaires.py,sha256=Sl8YHXgL42xiijUncycOUzGu5MtI3jEnhADS8Nol6N8,321
85
86
  tests/resources/test_resources.py,sha256=rTcfjZOxujOJXjfqvOV6TPpYl8lae4bgbZj4jTAWm_o,170
86
87
  tests/resources/test_savings.py,sha256=2qlGo9Qy_bqwYfMmjf9OsPIPVWRb6zlkzaMgg5RWElk,1127
87
88
  tests/resources/test_service_providers.py,sha256=yhjTvRdVaTpwEHLVtvX8OD6bMef2W9wUI8MRwLY-i64,563
88
- tests/resources/test_sessions.py,sha256=kLmDQKNqQ-sStQsc3L8OIcvPZMAODdWKkjK_mndYRpc,1377
89
+ tests/resources/test_sessions.py,sha256=2VXc7p1bWQqmVNASxaB4L51x8ALKP44vnVuKUyomIUo,1410
89
90
  tests/resources/test_statements.py,sha256=e9S_yn5kD6M8IpfpRmIOJ0Y6aggBkYWQxynY6P7Q7nI,370
90
91
  tests/resources/test_transfers.py,sha256=bW3igYOdYPDiZtLr8WVIYwfP-dV4sdJ9pbaXFps2ac8,4161
91
92
  tests/resources/test_user_credentials.py,sha256=WbK20aprlT3P_IEOwplvhIYnLfTgGhK3Q3Tu6Tf129c,809
@@ -97,8 +98,8 @@ tests/resources/test_verifications.py,sha256=yyL-bdryQU3MvqnmAgnnzGG9t7UTxWwPiVu
97
98
  tests/resources/test_wallet_transactions.py,sha256=_L2hjPHT4FwwhxksUoaoVHwFFYOGWfF4ScCbk0kb7Hw,3945
98
99
  tests/resources/test_webhooks.py,sha256=nYCqAnlNJcMJKRHhgoHOWTQnFLWQHHvFyY8GVCxGTD8,328
99
100
  tests/resources/test_whatsapp_transfers.py,sha256=4Dmrsbytx7LRrLQo9M8TAL7cGKJufPStkp51UdRCnYU,1030
100
- cuenca-2.0.0.dev4.dist-info/LICENSE,sha256=aWv5PmUiAcNENEAdghcVQSeU56pXJHWexJYgklK9XLg,1063
101
- cuenca-2.0.0.dev4.dist-info/METADATA,sha256=IThOyUkBWHEQdmxuWJrmOQ5wnCgPDUdyqEDSpZ1-e1c,4972
102
- cuenca-2.0.0.dev4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
103
- cuenca-2.0.0.dev4.dist-info/top_level.txt,sha256=5h3K7XJTmJniDloPq4sIJHni_xLw-Uoc6ZJ5mcw_lZY,13
104
- cuenca-2.0.0.dev4.dist-info/RECORD,,
101
+ cuenca-2.0.0.dev6.dist-info/LICENSE,sha256=aWv5PmUiAcNENEAdghcVQSeU56pXJHWexJYgklK9XLg,1063
102
+ cuenca-2.0.0.dev6.dist-info/METADATA,sha256=kfjMPqTPVjnPpePmznTXiAQ38-9AlXF4gzl4cegcdb8,4972
103
+ cuenca-2.0.0.dev6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
104
+ cuenca-2.0.0.dev6.dist-info/top_level.txt,sha256=5h3K7XJTmJniDloPq4sIJHni_xLw-Uoc6ZJ5mcw_lZY,13
105
+ cuenca-2.0.0.dev6.dist-info/RECORD,,
@@ -18,7 +18,7 @@ def test_api_keys_retrieve():
18
18
  id_key = 'AKMPSxy2UeSKqU1J6spDNwqA'
19
19
  api_key: ApiKey = ApiKey.retrieve(id_key)
20
20
  assert api_key.id == id_key
21
- assert api_key.secret == '********'
21
+ assert api_key.secret.get_secret_value() == '********'
22
22
 
23
23
 
24
24
  @pytest.mark.vcr
@@ -20,5 +20,5 @@ def test_login_token(session):
20
20
  UserLogin.create('222222', session=session)
21
21
  login_token = LoginToken.create(session=session)
22
22
  session.headers.pop('X-Cuenca-LoginId')
23
- session.configure(login_token=login_token.id)
23
+ session.configure(login_token=login_token.id.get_secret_value())
24
24
  Transfer.count(session=session)
@@ -25,4 +25,4 @@ def test_otps(session):
25
25
  session.configure(login_token=login_token.id)
26
26
  otp = Otp.create()
27
27
  assert otp
28
- assert isinstance(otp.secret, str)
28
+ assert isinstance(otp.secret.get_secret_value(), str)
@@ -36,6 +36,8 @@ def test_session_create(curp_validation_request: dict, user_request: dict):
36
36
  assert user_session.failure_url == failure_url
37
37
 
38
38
  ephimeral_cuenca_session = cuenca.http.Session()
39
- ephimeral_cuenca_session.configure(session_token=user_session.id)
39
+ ephimeral_cuenca_session.configure(
40
+ session_token=user_session.id.get_secret_value()
41
+ )
40
42
  user = User.update(user.id, email_address='manu@example.com')
41
43
  assert user.email_address == 'manu@example.com'