Skip to content

Commit b517b32

Browse files
authored
Expired signature fix (#197)
* fix * restore values * no print * cassettes * bump
1 parent 7453795 commit b517b32

File tree

3 files changed

+39
-58
lines changed

3 files changed

+39
-58
lines changed

cuenca/jwt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def get_expiration_date(token: str) -> dt.datetime:
4242
@classmethod
4343
def create(cls, session: 'Session') -> 'Jwt':
4444
session.jwt_token = None
45+
session.session.headers.pop('X-Cuenca-Token', None)
4546
token = session.post('/token', dict())['token']
4647
expires_at = Jwt.get_expiration_date(token)
4748
return cls(expires_at, token)

cuenca/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '0.7.12'
1+
__version__ = '0.7.13'
22
CLIENT_VERSION = __version__
33
API_VERSION = '2020-03-19'

tests/http/cassettes/test_request_expired_token.yaml

Lines changed: 37 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
body: null
3+
body: '{}'
44
headers:
55
Accept:
66
- '*/*'
@@ -11,38 +11,32 @@ interactions:
1111
Connection:
1212
- keep-alive
1313
Content-Length:
14-
- '0'
14+
- '2'
15+
Content-Type:
16+
- application/json
1517
User-Agent:
16-
- cuenca-python/0.3.6
18+
- cuenca-python/0.7.12
1719
X-Cuenca-Api-Version:
1820
- '2020-03-19'
1921
method: POST
2022
uri: https://api.cuenca.com/token
2123
response:
2224
body:
23-
string: '{"id":12,"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MDM5MTA5NDksImlhdCI6MTYwMzMwNjE0OSwic3ViIjoiQUtib3hCeXNTd1NTbVR0VmtoT1I2X21RIiwidWlkIjoiMWFkNWUwZTMtMTNjZS0xMWViLTg0MjItNDE3MmZhYTQwZjQyIn0.5OX-MCcgi4cyiGexSsDIwk8HyhJxuIT8VF7X41GkO6w","created_at":"2020-10-21T18:49:09.935845","api_key":{"id":"AKboxBysSwSSmTtVkhOR6_mQ","created_at":"2020-10-20T23:56:28.845757","secret":"********","deactivated_at":null,"user_id":"rsc"}}'
25+
string: '{"id":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MzQ3NzMwNzEsImlhdCI6MTYzNDc3MzAxMSwic3ViIjoiQUtRRXJUbXdlZFFxQ0xwQ2plWkc4c0pRIiwidWlkIjoiOTljZDMyYTItMzFmZS0xMWVjLTgyMGEtMDI0MmFjMTEwMDAyIn0.EjDd6PpYWLCsuYhd98CdBCj6fThrVWX_X4uNW_tKVpg","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MzQ3NzMwNzEsImlhdCI6MTYzNDc3MzAxMSwic3ViIjoiQUtRRXJUbXdlZFFxQ0xwQ2plWkc4c0pRIiwidWlkIjoiOTljZDMyYTItMzFmZS0xMWVjLTgyMGEtMDI0MmFjMTEwMDAyIn0.EjDd6PpYWLCsuYhd98CdBCj6fThrVWX_X4uNW_tKVpg","created_at":"2021-10-20T23:36:51.346137","api_key_uri":"/api_key/AKQErTmwedQqCLpCjeZG8sJQ"}'
2426
headers:
25-
Connection:
26-
- keep-alive
27-
Content-Length:
28-
- '438'
29-
Content-Type:
27+
content-length:
28+
- '576'
29+
content-type:
3030
- application/json
31-
Date:
32-
- Wed, 21 Oct 2020 18:49:09 GMT
33-
Server:
34-
- nginx/1.18.0
35-
X-Amzn-Trace-Id:
36-
- Root=1-5f9082a5-37ce7b1275ae2055215eb14d;Sampled=0
37-
x-amz-apigw-id:
38-
- UxlZ8FEyCYcFUuQ=
39-
x-amzn-RequestId:
40-
- ee534c24-2878-4efe-b91e-3c99757adff6
31+
date:
32+
- Wed, 20 Oct 2021 23:36:50 GMT
33+
server:
34+
- uvicorn
4135
status:
4236
code: 201
4337
message: Created
4438
- request:
45-
body: null
39+
body: '{}'
4640
headers:
4741
Accept:
4842
- '*/*'
@@ -53,35 +47,27 @@ interactions:
5347
Connection:
5448
- keep-alive
5549
Content-Length:
56-
- '0'
50+
- '2'
51+
Content-Type:
52+
- application/json
5753
User-Agent:
58-
- cuenca-python/0.3.6
54+
- cuenca-python/0.7.12
5955
X-Cuenca-Api-Version:
6056
- '2020-03-19'
61-
X-Cuenca-Token:
62-
- DUMMY
6357
method: POST
6458
uri: https://api.cuenca.com/token
6559
response:
6660
body:
67-
string: '{"id":13,"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MDM5MTA5NTAsImlhdCI6MTYwMzMwNjE1MCwic3ViIjoiQUtib3hCeXNTd1NTbVR0VmtoT1I2X21RIiwidWlkIjoiMWFlMjQ5MjUtMTNjZS0xMWViLTk0ZDQtNDE3MmZhYTQwZjQyIn0.GmDxVfvt2Es6mf1upY5Y7RdkGgeos7mTpA_7wFb8ZaI","created_at":"2020-10-21T18:49:10.017165","api_key":{"id":"AKboxBysSwSSmTtVkhOR6_mQ","created_at":"2020-10-20T23:56:28.845757","secret":"********","deactivated_at":null,"user_id":"rsc"}}'
61+
string: '{"id":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MzQ3NzMwNzEsImlhdCI6MTYzNDc3MzAxMSwic3ViIjoiQUtRRXJUbXdlZFFxQ0xwQ2plWkc4c0pRIiwidWlkIjoiOWExZDI0NDItMzFmZS0xMWVjLTgyMGEtMDI0MmFjMTEwMDAyIn0.cJ_W7Dbn7M1w2yNDHwSxa92iqT-twpUwNIFoHOHaNV8","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MzQ3NzMwNzEsImlhdCI6MTYzNDc3MzAxMSwic3ViIjoiQUtRRXJUbXdlZFFxQ0xwQ2plWkc4c0pRIiwidWlkIjoiOWExZDI0NDItMzFmZS0xMWVjLTgyMGEtMDI0MmFjMTEwMDAyIn0.cJ_W7Dbn7M1w2yNDHwSxa92iqT-twpUwNIFoHOHaNV8","created_at":"2021-10-20T23:36:51.870084","api_key_uri":"/api_key/AKQErTmwedQqCLpCjeZG8sJQ"}'
6862
headers:
69-
Connection:
70-
- keep-alive
71-
Content-Length:
72-
- '438'
73-
Content-Type:
63+
content-length:
64+
- '576'
65+
content-type:
7466
- application/json
75-
Date:
76-
- Wed, 21 Oct 2020 18:49:10 GMT
77-
Server:
78-
- nginx/1.18.0
79-
X-Amzn-Trace-Id:
80-
- Root=1-5f9082a5-25f2f46b7c8b558769ecf708;Sampled=0
81-
x-amz-apigw-id:
82-
- UxlZ8Gs5CYcFtFg=
83-
x-amzn-RequestId:
84-
- 6553d156-d57e-48a4-b16a-42588c221827
67+
date:
68+
- Wed, 20 Oct 2021 23:36:50 GMT
69+
server:
70+
- uvicorn
8571
status:
8672
code: 201
8773
message: Created
@@ -92,10 +78,12 @@ interactions:
9278
- '*/*'
9379
Accept-Encoding:
9480
- gzip, deflate
81+
Authorization:
82+
- DUMMY
9583
Connection:
9684
- keep-alive
9785
User-Agent:
98-
- cuenca-python/0.3.6
86+
- cuenca-python/0.7.12
9987
X-Cuenca-Api-Version:
10088
- '2020-03-19'
10189
X-Cuenca-Token:
@@ -104,24 +92,16 @@ interactions:
10492
uri: https://api.cuenca.com/api_keys
10593
response:
10694
body:
107-
string: '{"items":[{"id":"AKboxBysSwSSmTtVkhOR6_mQ","created_at":"2020-10-20T23:56:28.845757","secret":"********","deactivated_at":null,"user_id":"rsc"}],"next_page_uri":null}'
95+
string: '{"items":[{"id":"AKSIiEK7vWQRiea1VAJZpQRA","created_at":"2021-04-06T00:42:59.852000","secret":"********","deactivated_at":"2212-12-01T00:28:40.075000","user_id":"USaNW8apNBSc-FiOWMX9NEKg","updated_at":"2021-04-06T00:28:40.075000"},{"id":"AKBCEuSw11RSmwhwL_I1UrHg","created_at":"2021-04-06T00:36:25.322000","secret":"********","deactivated_at":"2212-12-01T00:28:40.075000","user_id":"USaNW8apNBSc-FiOWMX9NEKg","updated_at":"2021-04-06T00:28:40.075000"},{"id":"AKQErTmwedQqCLpCjeZG8sJQ","created_at":"2021-02-21T05:24:08.060000","secret":"********","deactivated_at":"2212-10-18T05:21:09.897000","user_id":"USaNW8apNBSc-FiOWMX9NEKg","updated_at":"2021-02-25T23:12:05.812000"}],"next_page_uri":null}'
10896
headers:
109-
Connection:
110-
- keep-alive
111-
Content-Length:
112-
- '166'
113-
Content-Type:
97+
content-length:
98+
- '695'
99+
content-type:
114100
- application/json
115-
Date:
116-
- Wed, 21 Oct 2020 18:49:10 GMT
117-
Server:
118-
- nginx/1.18.0
119-
X-Amzn-Trace-Id:
120-
- Root=1-5f9082a6-6a70a6d03f0698b549541398;Sampled=0
121-
x-amz-apigw-id:
122-
- UxlZ9G4tiYcFmjQ=
123-
x-amzn-RequestId:
124-
- e3f54e5b-13ec-4cf8-83da-4f93f7bd9c54
101+
date:
102+
- Wed, 20 Oct 2021 23:36:50 GMT
103+
server:
104+
- uvicorn
125105
status:
126106
code: 200
127107
message: OK

0 commit comments

Comments
 (0)