web3 7.0.0b6__py3-none-any.whl → 7.0.0b7__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.
- ens/__init__.py +13 -2
- web3/__init__.py +21 -5
- web3/_utils/contract_sources/contract_data/arrays_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/bytes_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/constructor_contracts.py +7 -7
- web3/_utils/contract_sources/contract_data/contract_caller_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/emitter_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/event_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/extended_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/fallback_function_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/math_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_lookup.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/panic_errors_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/payable_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/receive_function_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/reflector_contracts.py +3 -3
- web3/_utils/contract_sources/contract_data/revert_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/simple_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/storage_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/string_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/tuple_contracts.py +5 -5
- web3/_utils/http.py +3 -0
- web3/_utils/http_session_manager.py +280 -0
- web3/_utils/method_formatters.py +0 -2
- web3/_utils/module_testing/eth_module.py +82 -109
- web3/_utils/module_testing/module_testing_utils.py +14 -9
- web3/_utils/module_testing/persistent_connection_provider.py +1 -0
- web3/_utils/rpc_abi.py +0 -3
- web3/beacon/__init__.py +5 -0
- web3/beacon/async_beacon.py +9 -5
- web3/beacon/beacon.py +7 -5
- web3/contract/__init__.py +7 -0
- web3/contract/base_contract.py +10 -1
- web3/eth/__init__.py +7 -0
- web3/eth/async_eth.py +0 -33
- web3/eth/eth.py +2 -53
- web3/middleware/__init__.py +17 -0
- web3/providers/__init__.py +21 -0
- web3/providers/eth_tester/__init__.py +5 -0
- web3/providers/eth_tester/defaults.py +0 -6
- web3/providers/eth_tester/middleware.py +3 -8
- web3/providers/persistent/__init__.py +7 -0
- web3/providers/rpc/__init__.py +5 -0
- web3/providers/rpc/async_rpc.py +16 -12
- web3/providers/rpc/rpc.py +16 -12
- web3/providers/rpc/utils.py +0 -3
- web3/tools/benchmark/main.py +7 -6
- web3/tools/benchmark/node.py +1 -1
- web3/utils/__init__.py +14 -5
- web3/utils/async_exception_handling.py +19 -7
- web3/utils/exception_handling.py +7 -5
- {web3-7.0.0b6.dist-info → web3-7.0.0b7.dist-info}/METADATA +7 -5
- {web3-7.0.0b6.dist-info → web3-7.0.0b7.dist-info}/RECORD +58 -59
- {web3-7.0.0b6.dist-info → web3-7.0.0b7.dist-info}/WHEEL +1 -1
- web3/_utils/contract_sources/contract_data/address_reflector.py +0 -29
- web3/_utils/request.py +0 -265
- {web3-7.0.0b6.dist-info → web3-7.0.0b7.dist-info}/LICENSE +0 -0
- {web3-7.0.0b6.dist-info → web3-7.0.0b7.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: web3
|
|
3
|
-
Version: 7.0.
|
|
3
|
+
Version: 7.0.0b7
|
|
4
4
|
Summary: web3: A Python library for interacting with Ethereum
|
|
5
5
|
Home-page: https://github.com/ethereum/web3.py
|
|
6
6
|
Author: The Ethereum Foundation
|
|
@@ -51,8 +51,9 @@ Requires-Dist: sphinx >=6.0.0 ; extra == 'dev'
|
|
|
51
51
|
Requires-Dist: sphinx-autobuild >=2021.3.14 ; extra == 'dev'
|
|
52
52
|
Requires-Dist: sphinx-rtd-theme >=1.0.0 ; extra == 'dev'
|
|
53
53
|
Requires-Dist: towncrier <22,>=21 ; extra == 'dev'
|
|
54
|
-
Requires-Dist: eth-
|
|
55
|
-
Requires-Dist: py-
|
|
54
|
+
Requires-Dist: eth-account >=0.13.0 ; extra == 'dev'
|
|
55
|
+
Requires-Dist: eth-tester[py-evm] <0.13.0b1,>=0.11.0b1 ; extra == 'dev'
|
|
56
|
+
Requires-Dist: py-geth >=5.0.0b1 ; extra == 'dev'
|
|
56
57
|
Requires-Dist: pytest-asyncio <0.23,>=0.18.1 ; extra == 'dev'
|
|
57
58
|
Requires-Dist: pytest-xdist >=2.4.0 ; extra == 'dev'
|
|
58
59
|
Requires-Dist: pytest >=7.0.0 ; extra == 'dev'
|
|
@@ -61,9 +62,10 @@ Requires-Dist: sphinx >=6.0.0 ; extra == 'docs'
|
|
|
61
62
|
Requires-Dist: sphinx-autobuild >=2021.3.14 ; extra == 'docs'
|
|
62
63
|
Requires-Dist: sphinx-rtd-theme >=1.0.0 ; extra == 'docs'
|
|
63
64
|
Requires-Dist: towncrier <22,>=21 ; extra == 'docs'
|
|
65
|
+
Requires-Dist: eth-account >=0.13.0 ; extra == 'docs'
|
|
64
66
|
Provides-Extra: test
|
|
65
|
-
Requires-Dist: eth-tester[py-evm] <0.
|
|
66
|
-
Requires-Dist: py-geth >=
|
|
67
|
+
Requires-Dist: eth-tester[py-evm] <0.13.0b1,>=0.11.0b1 ; extra == 'test'
|
|
68
|
+
Requires-Dist: py-geth >=5.0.0b1 ; extra == 'test'
|
|
67
69
|
Requires-Dist: pytest-asyncio <0.23,>=0.18.1 ; extra == 'test'
|
|
68
70
|
Requires-Dist: pytest-mock >=1.10 ; extra == 'test'
|
|
69
71
|
Requires-Dist: pytest-xdist >=2.4.0 ; extra == 'test'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
ens/__init__.py,sha256=
|
|
1
|
+
ens/__init__.py,sha256=BtOyGF_JrIpWFTr_T1GCJuUtmZI-Qf-v560uzTWp18E,471
|
|
2
2
|
ens/_normalization.py,sha256=U1CbJhX6R1kYPPlYq4IampbSuql97J6tcq3xnIwmpEs,16786
|
|
3
3
|
ens/abis.py,sha256=0Ec_lqe7HBsVpQrID3ccFMhx8Vb7S0TGFbeuRdXhuCE,34745
|
|
4
4
|
ens/async_ens.py,sha256=jAUIblA4bW-gliAw-cKcu9xYgySBbFbv9tnVAk1iedE,22414
|
|
@@ -11,7 +11,7 @@ ens/exceptions.py,sha256=iJWDuOX1xXNgMlzuPX7NyArLTxK0LoowJyExyRLSDj0,2683
|
|
|
11
11
|
ens/utils.py,sha256=ZtKimoQdEm1HxsEmJxe1fo1PQZGaP_wRSU6ai9-HVu0,9421
|
|
12
12
|
ens/specs/nf.json,sha256=kGZcTE_UxTl3WZwMUP6m8KbQQOKdw7PWzmuW7ewQSUs,48403
|
|
13
13
|
ens/specs/normalization_spec.json,sha256=xn3N9a-6KHMLu3MeCBsmOxSzIzUQykzE9EscKK1a3w8,3115334
|
|
14
|
-
web3/__init__.py,sha256=
|
|
14
|
+
web3/__init__.py,sha256=P11QAEV_GYoZq9ij8gDzFx5tKzJY2aMXG-keg2Lg1xs,1277
|
|
15
15
|
web3/constants.py,sha256=eQLRQVMFPbgpOjjkPTMHkY-syncJuO-sPX5UrCSRjzQ,564
|
|
16
16
|
web3/datastructures.py,sha256=Yc45cXgoXvhV0HPvnmkFFOEVDtLr-Pftc_f5q-uQY1M,10939
|
|
17
17
|
web3/exceptions.py,sha256=VoB2dwZagBVTJn9712xcdJJPyq_bwhFt4prf2H9ukMs,8742
|
|
@@ -45,14 +45,14 @@ web3/_utils/fee_utils.py,sha256=hlY-PDtXNddufcpBQHxWmd7wwK3-XcaJ8trRpKKb8sA,2099
|
|
|
45
45
|
web3/_utils/filters.py,sha256=M9FpffgVXmDaoUk0HjAhVNi9Krq6hMlKE01n_JxHOMQ,11980
|
|
46
46
|
web3/_utils/formatters.py,sha256=RfRZU0aXC99s6OoLMY7D-fcYJyVAYBEwdbw-JIDjbZE,3067
|
|
47
47
|
web3/_utils/function_identifiers.py,sha256=m305lsvUZk-jkPixT0IJd9P5sXqMvmwlwlLeBgEAnBQ,55
|
|
48
|
-
web3/_utils/http.py,sha256=
|
|
48
|
+
web3/_utils/http.py,sha256=NNcbf_K814Ggpt0YiGTWjV3CCUrLkpZpQDru4f-3C9E,235
|
|
49
|
+
web3/_utils/http_session_manager.py,sha256=zOIEXELSYsbIq49JUJFY1jN5iPjENBkX1CPucqE3LNE,10726
|
|
49
50
|
web3/_utils/hypothesis.py,sha256=4Cm4iOWv-uP9irg_Pv63kYNDYUAGhnUH6fOPWRw3A0g,209
|
|
50
51
|
web3/_utils/math.py,sha256=4oU5YdbQBXElxK00CxmUZ94ApXFu9QT_TrO0Kho1HTs,1083
|
|
51
|
-
web3/_utils/method_formatters.py,sha256=
|
|
52
|
+
web3/_utils/method_formatters.py,sha256=khFByaPfqy6_BjxznaNiO04fgMYTRYwD-7nIhXmNT6I,33507
|
|
52
53
|
web3/_utils/module.py,sha256=GuVePloTlIBZwFDOjg0zasp53HSJ32umxN1nQhqW-8Y,3175
|
|
53
54
|
web3/_utils/normalizers.py,sha256=Q5urvzI9nbtNiqzhrrIMtZ5NqOAxWE4Xp5srZFs0Baw,7392
|
|
54
|
-
web3/_utils/
|
|
55
|
-
web3/_utils/rpc_abi.py,sha256=WAqi4E46ISt9RzU74zUH4FAez9k9CJ7qr_M94fGzKZ0,8529
|
|
55
|
+
web3/_utils/rpc_abi.py,sha256=ey3rw3j2jC9ybs1FZpyCPReA0Mra7TwRX1a7GTtOPeE,8392
|
|
56
56
|
web3/_utils/threads.py,sha256=hNlSd_zheQYN0vC1faWWb9_UQxp_UzaM2fI5C8y0kB0,4245
|
|
57
57
|
web3/_utils/transactions.py,sha256=eGnFlVtzvlcDsF8-Gnbai4rjVP9iWpQ5CaAx6Ml9K8g,8912
|
|
58
58
|
web3/_utils/type_conversion.py,sha256=s6cg3WDCQIarQLWw_GfctaJjXhS_EcokUNO-S_ccvng,873
|
|
@@ -64,56 +64,55 @@ web3/_utils/contract_sources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
|
64
64
|
web3/_utils/contract_sources/compile_contracts.py,sha256=C3eLY6gJ4xj9FunNwn4YPb9c8ElORkN8O4ddBa_kKqI,6486
|
|
65
65
|
web3/_utils/contract_sources/contract_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
66
66
|
web3/_utils/contract_sources/contract_data/_custom_contract_data.py,sha256=nxpN2uS1T338Tp5uVhwY9U1C2m2pdDz7kZv3LoZ0hpo,552
|
|
67
|
-
web3/_utils/contract_sources/contract_data/
|
|
68
|
-
web3/_utils/contract_sources/contract_data/
|
|
69
|
-
web3/_utils/contract_sources/contract_data/
|
|
70
|
-
web3/_utils/contract_sources/contract_data/
|
|
71
|
-
web3/_utils/contract_sources/contract_data/
|
|
72
|
-
web3/_utils/contract_sources/contract_data/
|
|
73
|
-
web3/_utils/contract_sources/contract_data/
|
|
74
|
-
web3/_utils/contract_sources/contract_data/
|
|
75
|
-
web3/_utils/contract_sources/contract_data/
|
|
76
|
-
web3/_utils/contract_sources/contract_data/
|
|
77
|
-
web3/_utils/contract_sources/contract_data/
|
|
78
|
-
web3/_utils/contract_sources/contract_data/
|
|
79
|
-
web3/_utils/contract_sources/contract_data/
|
|
80
|
-
web3/_utils/contract_sources/contract_data/
|
|
81
|
-
web3/_utils/contract_sources/contract_data/
|
|
82
|
-
web3/_utils/contract_sources/contract_data/
|
|
83
|
-
web3/_utils/contract_sources/contract_data/
|
|
84
|
-
web3/_utils/contract_sources/contract_data/
|
|
85
|
-
web3/_utils/contract_sources/contract_data/
|
|
86
|
-
web3/_utils/contract_sources/contract_data/
|
|
87
|
-
web3/_utils/contract_sources/contract_data/
|
|
88
|
-
web3/_utils/contract_sources/contract_data/tuple_contracts.py,sha256=qt0cGM1Kh-LlRYn04-fpSPQJAWcGrvP8EKPCJvsrnvE,23180
|
|
67
|
+
web3/_utils/contract_sources/contract_data/arrays_contract.py,sha256=c5liWEOYh-fW-v3XQlJ33AOmU_TzyoFoivmfzIuBSYk,18626
|
|
68
|
+
web3/_utils/contract_sources/contract_data/bytes_contracts.py,sha256=J_JL0sFLzVzopHHpSmBh4xbrSi8qc6VJtQ0iepjhEb4,14333
|
|
69
|
+
web3/_utils/contract_sources/contract_data/constructor_contracts.py,sha256=FKs_mbKhx6-CTA-as-qLeeQV8466c6X7tMVK3JOa9Jk,6047
|
|
70
|
+
web3/_utils/contract_sources/contract_data/contract_caller_tester.py,sha256=CsGnQ6O1RuaHmRohYXkDvSF3Kvu3-es2KFox6-zp5EY,6228
|
|
71
|
+
web3/_utils/contract_sources/contract_data/emitter_contract.py,sha256=tTLfAh2W0n4JQkZchKE-aOQGijKCvb_kCWALa6AQ6Dw,40861
|
|
72
|
+
web3/_utils/contract_sources/contract_data/event_contracts.py,sha256=tNN0hoCyYQX0aC_eo-5AeJT6upYhLFxFDIN5CJG1KSE,5569
|
|
73
|
+
web3/_utils/contract_sources/contract_data/extended_resolver.py,sha256=R9m5FZUOXyqT4duYRNV4DKDnDQMK_1xx9ov67-Y7tLM,15720
|
|
74
|
+
web3/_utils/contract_sources/contract_data/fallback_function_contract.py,sha256=3-gNFuU8PgLOelbE8qs-J8jrPOMbPwApvn74vHiNIws,1649
|
|
75
|
+
web3/_utils/contract_sources/contract_data/function_name_tester_contract.py,sha256=h1_PaEnjd7BheZ_R50pfSSoxU_6fJgSIMsIBgF-qrfY,1882
|
|
76
|
+
web3/_utils/contract_sources/contract_data/math_contract.py,sha256=JX68IX24anGj5p51VHCG8wD7Xs47N1iEpbHYLDVMkVU,7635
|
|
77
|
+
web3/_utils/contract_sources/contract_data/offchain_lookup.py,sha256=v-67wwc5kmBOfw8XMubS02RswhEMK8lpLKkZKs9Pr5U,16434
|
|
78
|
+
web3/_utils/contract_sources/contract_data/offchain_resolver.py,sha256=xawA9eEzwW89pGw_XcFY-crSbJp9VZrgoDqSV7yWnf8,31817
|
|
79
|
+
web3/_utils/contract_sources/contract_data/panic_errors_contract.py,sha256=S9BfCX9VH05KU5RPunYJzGTGbkCWBQiiO5ILDU1Oud8,15245
|
|
80
|
+
web3/_utils/contract_sources/contract_data/payable_tester.py,sha256=wnVaWYIOZy0rA34Os2_zZuj2vHEkJAbCJVvHa0gYtiY,1823
|
|
81
|
+
web3/_utils/contract_sources/contract_data/receive_function_contracts.py,sha256=J5a2T-IjM3zkjZOTk1NLNuJPG0PUhq2NQeK2821MvBk,17078
|
|
82
|
+
web3/_utils/contract_sources/contract_data/reflector_contracts.py,sha256=wYmbTWMAxQeHpiraI3msvYBF93hEkxr1OmbbpSjWpAE,5262
|
|
83
|
+
web3/_utils/contract_sources/contract_data/revert_contract.py,sha256=VlSqY8vuiR9cbRD2cvq9CcJMqtD-2_kSxQw1-NfNOlM,4262
|
|
84
|
+
web3/_utils/contract_sources/contract_data/simple_resolver.py,sha256=yjMu0Fe4xgI0wo2KYOAxqHjC2ld4OVaaz75PapRFv4w,3553
|
|
85
|
+
web3/_utils/contract_sources/contract_data/storage_contract.py,sha256=vP1QaekjldOJ_2e2noMKbCfp1eOFG7q8KrFvnOEuv0E,7932
|
|
86
|
+
web3/_utils/contract_sources/contract_data/string_contract.py,sha256=y6EFnum4zDrrRUmuXExCGr2bhZMrerbMiqJiamUU2Tw,11210
|
|
87
|
+
web3/_utils/contract_sources/contract_data/tuple_contracts.py,sha256=QuqPfv3BxjqDjeLScnxJDEPtPZMAB4jwHxsAOeVd6kk,23176
|
|
89
88
|
web3/_utils/module_testing/__init__.py,sha256=tPFAaX7xOR50CPTq24UeY-1CX1LQxxmEOPr0-tIRkoE,376
|
|
90
|
-
web3/_utils/module_testing/eth_module.py,sha256=
|
|
89
|
+
web3/_utils/module_testing/eth_module.py,sha256=sMrza5Yg_Sw8xdCUnSZL_Kzj7MyZL_Qxv1ady43vCn8,185007
|
|
91
90
|
web3/_utils/module_testing/go_ethereum_admin_module.py,sha256=_c-6SyzZkfAJ-7ySXUpw9FEr4cg-ShRdAGSAHWanCtY,3406
|
|
92
91
|
web3/_utils/module_testing/go_ethereum_txpool_module.py,sha256=5f8XL8-2x3keyGRaITxMQYl9oQzjgqGn8zobB-j9BPs,1176
|
|
93
|
-
web3/_utils/module_testing/module_testing_utils.py,sha256=
|
|
92
|
+
web3/_utils/module_testing/module_testing_utils.py,sha256=m5-mnIf29F2hGgFX-7kv0kdESTcvMu9UtzK0RGT3XTU,5908
|
|
94
93
|
web3/_utils/module_testing/net_module.py,sha256=ifUTC-5fTcQbwpm0X09OdD5RSPnn00T8klFeYe8tTm4,1272
|
|
95
|
-
web3/_utils/module_testing/persistent_connection_provider.py,sha256=
|
|
94
|
+
web3/_utils/module_testing/persistent_connection_provider.py,sha256=py52pWgdP4E3JORGTFo-CEzKqb56FwKSlzdaH-i7oQs,16618
|
|
96
95
|
web3/_utils/module_testing/utils.py,sha256=7jYtIKfOdrQnj1pDB0gLyoN_b8U3ZyEYbMU4dxaLljs,10023
|
|
97
96
|
web3/_utils/module_testing/web3_module.py,sha256=lfLOshDOr-SpnaN0iVcff-q-HUOw8XSBIwQeBO7TaJo,25121
|
|
98
97
|
web3/auto/__init__.py,sha256=ZbzAiCZMdt_tCTTPvH6t8NCVNroKKkt7TSVBBNR74Is,44
|
|
99
98
|
web3/auto/gethdev.py,sha256=MuWD2gxv0xDv_SzPsp9mSkS1oG4P54xFK83qw9NvswA,438
|
|
100
|
-
web3/beacon/__init__.py,sha256=
|
|
99
|
+
web3/beacon/__init__.py,sha256=Ac6YiNgU8D8Ynnh5RwSCx2NwPyjnpFjpXeHuSssFbaU,113
|
|
101
100
|
web3/beacon/api_endpoints.py,sha256=dkekSCmkat5QIfwKzwm49CyVcRb-pIbn1nZHB4F8M0U,2208
|
|
102
|
-
web3/beacon/async_beacon.py,sha256=
|
|
103
|
-
web3/beacon/beacon.py,sha256=
|
|
104
|
-
web3/contract/__init__.py,sha256=
|
|
101
|
+
web3/beacon/async_beacon.py,sha256=5PErS2VjhNj-GPg3WKxxJv02ZZWyu3m46sWjGMpi33A,7602
|
|
102
|
+
web3/beacon/beacon.py,sha256=NT4ebD53uesPj8I0CpqkBJ_U-o2_QFLRVM7tNnlVY0Q,6758
|
|
103
|
+
web3/contract/__init__.py,sha256=qeZRtTw9xriwoD82w6vePDuPBZ35-CMVdkzViBSH3Qs,293
|
|
105
104
|
web3/contract/async_contract.py,sha256=LiYBEOh11myVOuHss9iwHDQcLAHtsSW1mlzpcDnMvmo,20515
|
|
106
|
-
web3/contract/base_contract.py,sha256=
|
|
105
|
+
web3/contract/base_contract.py,sha256=qMiiHsP9vfLl8CGhWNQe5mhd2ZW4XeuNatEoMqif35g,37191
|
|
107
106
|
web3/contract/contract.py,sha256=cF0tsOjbJpg6zOBqZ_02btl3O4HTABcEnUzYzFiDcpo,20124
|
|
108
107
|
web3/contract/utils.py,sha256=vymvU8edobFFQ8pu2RsWr-uUXiF__TWzwFo5TRorWZk,16662
|
|
109
|
-
web3/eth/__init__.py,sha256=
|
|
110
|
-
web3/eth/async_eth.py,sha256=
|
|
108
|
+
web3/eth/__init__.py,sha256=qDLxOcHHIzzPD7xzwy6Wcs0lLPQieB7WN0Ax25ctit8,197
|
|
109
|
+
web3/eth/async_eth.py,sha256=cy9S1UnCjG9wXCURT4XbTjdIxVEacwuzcTZpW-AfKYg,23334
|
|
111
110
|
web3/eth/base_eth.py,sha256=UUH0Fw0HVa_mBEQ_CbCDO01yCVDsj33d8yOv7Oe-QD0,6905
|
|
112
|
-
web3/eth/eth.py,sha256=
|
|
111
|
+
web3/eth/eth.py,sha256=oQPxQUzn0fgPcrXmzP-jP3ED7A_6Uwhk38LAv24sfnU,19865
|
|
113
112
|
web3/gas_strategies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
114
113
|
web3/gas_strategies/rpc.py,sha256=3Va-32jdmHkX7tzQCmh17ms2D6te5zZcqHP1326BdpY,352
|
|
115
114
|
web3/gas_strategies/time_based.py,sha256=48aFmh3FWgswD1DZlHllLOXrBm8Abh7rHmeo0IHTrAw,8949
|
|
116
|
-
web3/middleware/__init__.py,sha256=
|
|
115
|
+
web3/middleware/__init__.py,sha256=fSmPCYJOO8Qp5p-Vm_Z4XPJATu2qN7KJRypYNSO6_uM,2830
|
|
117
116
|
web3/middleware/attrdict.py,sha256=NY5yxlFOfLBBmcIjl8R-uP2dTz9ITIyTttG8-QcJWCI,2259
|
|
118
117
|
web3/middleware/base.py,sha256=AFIRLRxoQ63lEdhsRe-sATyHaYdiwNVklPOGc9ivXrA,5103
|
|
119
118
|
web3/middleware/buffered_gas_estimate.py,sha256=EmxUd-uO959UVroPsPKkl7oDa8Tw6N8BQLB6Urng5Eo,1647
|
|
@@ -126,43 +125,43 @@ web3/middleware/pythonic.py,sha256=awc8I6lLzVc2Iv138sps2uf6dMQipskLRBTdvTEEIgQ,3
|
|
|
126
125
|
web3/middleware/signing.py,sha256=8obqMCxrTuYgXezfTtic5CFrDrAqHikb-0PhQ3NmOz8,5742
|
|
127
126
|
web3/middleware/stalecheck.py,sha256=oWRA69BGIbNGjHSnUVOBnoxOYJZYjzRzlqqL5RRlnzk,2680
|
|
128
127
|
web3/middleware/validation.py,sha256=QxActrJk_zsXXiwpadP2MUjZBS5E50OJOtUwVrm9XVo,4280
|
|
129
|
-
web3/providers/__init__.py,sha256=
|
|
128
|
+
web3/providers/__init__.py,sha256=YkcSzE9AubvSp-UfvJjyCrdepvziysbqeq2LT0ImDoc,936
|
|
130
129
|
web3/providers/async_base.py,sha256=61eaIK-SyuIOoSIHOtJ9vNpxTRPqTxTS392_iMcVp8s,6832
|
|
131
130
|
web3/providers/auto.py,sha256=Zx3CHKoRkmiw3Jte2BLNPiJAFd8rDXNGfA3XtxZvHgc,3465
|
|
132
131
|
web3/providers/base.py,sha256=Dypc9zlrre4IFNglFOmR_1IcLCtCFzMAvnj_IYfYXpU,5884
|
|
133
132
|
web3/providers/ipc.py,sha256=wvC8Eq6OZ65ctpUAn9SvoBCLR_x-Hgur390_b3AU100,6355
|
|
134
133
|
web3/providers/legacy_websocket.py,sha256=6mFEQVlVoc71AyDvPGGt3KQudQKdMxoHvokg6Fb4VOw,4767
|
|
135
|
-
web3/providers/eth_tester/__init__.py,sha256=
|
|
136
|
-
web3/providers/eth_tester/defaults.py,sha256=
|
|
134
|
+
web3/providers/eth_tester/__init__.py,sha256=UggyBQdeAyjy1awATW1933jkJcpqqaUYUQEFAQnA2o0,163
|
|
135
|
+
web3/providers/eth_tester/defaults.py,sha256=9aPe0x2C5wahdGI_rZjiGR3Fe2LbMjKWH9o6eZPuY-Q,12577
|
|
137
136
|
web3/providers/eth_tester/main.py,sha256=U19sNDeHs36A4IYQ0HFGyXdZvuXiYvoSMNWVuki0WwI,7807
|
|
138
|
-
web3/providers/eth_tester/middleware.py,sha256=
|
|
139
|
-
web3/providers/persistent/__init__.py,sha256=
|
|
137
|
+
web3/providers/eth_tester/middleware.py,sha256=3h8q1WBu5CLiBYwonWFeAR_5pUy_vqgiDmi7wOzuorc,12971
|
|
138
|
+
web3/providers/persistent/__init__.py,sha256=X7tFKJL5BXSwciq5_bRwGRB6bfdWBkIPPWMqCjXIKrA,411
|
|
140
139
|
web3/providers/persistent/async_ipc.py,sha256=YtSZWlKwnr78ofBW31jTPpDAOK_Cs305oT-Y7Uhdhnw,6213
|
|
141
140
|
web3/providers/persistent/persistent.py,sha256=2dJtCfhK_Sm6wrEx807XbO0YhADM27agEI8sEgNwoWE,8918
|
|
142
141
|
web3/providers/persistent/persistent_connection.py,sha256=56yjpwDMM2phkJ_M5_QB-A6_CjZc5VrkWhNDweA70d0,1109
|
|
143
142
|
web3/providers/persistent/request_processor.py,sha256=E1jJwsvrPBTbufCy2LeNvMdRXf1H-Iz5WTsqyFvPGc0,14504
|
|
144
143
|
web3/providers/persistent/utils.py,sha256=gfY7w1HB8xuE7OujSrbwWYjQuQ8nzRBoxoL8ESinqWM,1140
|
|
145
144
|
web3/providers/persistent/websocket.py,sha256=L0jIBaSq2XBAPbzpJgBjDsUB0sfIl8p4af5fqIl56a0,5446
|
|
146
|
-
web3/providers/rpc/__init__.py,sha256=
|
|
147
|
-
web3/providers/rpc/async_rpc.py,sha256=
|
|
148
|
-
web3/providers/rpc/rpc.py,sha256=
|
|
149
|
-
web3/providers/rpc/utils.py,sha256=
|
|
145
|
+
web3/providers/rpc/__init__.py,sha256=mObsuwjr7xyHnnRlwzsmbp2JgZdn2NXSSctvpye4AuQ,149
|
|
146
|
+
web3/providers/rpc/async_rpc.py,sha256=hibsCoyrAD199ExAEyHRsEnZ0_rDP_2EC2k5g-D2zhw,5609
|
|
147
|
+
web3/providers/rpc/rpc.py,sha256=ePlGdlkvQTaf2Wi2khxiY-rRj-OFcPlpDMuTPLKaAyU,5655
|
|
148
|
+
web3/providers/rpc/utils.py,sha256=_mtoZMMIoZpPA8J8U5DfRxaNQmi8bw0ZVUiqn1Nz4co,2154
|
|
150
149
|
web3/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
151
150
|
web3/scripts/release/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
152
151
|
web3/scripts/release/test_package.py,sha256=DH0AryllcF4zfpWSd0NLPSQGHNoC-Qng5WYYbS5_4c8,1534
|
|
153
152
|
web3/tools/benchmark/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
154
|
-
web3/tools/benchmark/main.py,sha256=
|
|
155
|
-
web3/tools/benchmark/node.py,sha256=
|
|
153
|
+
web3/tools/benchmark/main.py,sha256=9nBC8yvdiNPoRuNlcqKC6HKWly_iwOYSeG0cOQCjfpg,5810
|
|
154
|
+
web3/tools/benchmark/node.py,sha256=n73GckmBKLm4_urC7HfF_Z3ZURffNMjq6ymzb9HM9c8,3252
|
|
156
155
|
web3/tools/benchmark/reporting.py,sha256=G2bj_Eo2kBV06GARDYK9zr0VqesiR0_5JLKvhAo6zRM,912
|
|
157
156
|
web3/tools/benchmark/utils.py,sha256=7OOdUD71AVWi0cowAE9ekMgqlfcJwk3vrNnMCHtiGdU,1696
|
|
158
|
-
web3/utils/__init__.py,sha256=
|
|
157
|
+
web3/utils/__init__.py,sha256=gDQ032U1WUUmzOdrrIdcQS4s_x5gUeRHV7xQ7kTClJs,596
|
|
159
158
|
web3/utils/abi.py,sha256=naNkD7_XQGV8hd4CkxytLKWCcgzUjkb7q3ERwRVNICI,498
|
|
160
159
|
web3/utils/address.py,sha256=KC_IpEbixSCuMhaW6V2QCyyJTYKYGS9c8QtI9_aH7zQ,967
|
|
161
|
-
web3/utils/async_exception_handling.py,sha256=
|
|
160
|
+
web3/utils/async_exception_handling.py,sha256=GZWSBFC0-Wmwz1tpTie-1AKRbIQH7JkmBpf5bXrUTzY,3320
|
|
162
161
|
web3/utils/caching.py,sha256=4U-vh61m1dlslwEn_Nl7ybIlMF4W2IAcvMTH-iFzrNM,1618
|
|
163
|
-
web3/utils/exception_handling.py,sha256=
|
|
164
|
-
web3-7.0.
|
|
165
|
-
web3-7.0.
|
|
166
|
-
web3-7.0.
|
|
167
|
-
web3-7.0.
|
|
168
|
-
web3-7.0.
|
|
162
|
+
web3/utils/exception_handling.py,sha256=k31JROfUyKIm9PoEWOtYSkIq9wL8SOBwQfnSLNQyfnM,3097
|
|
163
|
+
web3-7.0.0b7.dist-info/LICENSE,sha256=ScEyLx1vWrB0ybKiZKKTXm5QhVksHCEUtTp4lwYV45I,1095
|
|
164
|
+
web3-7.0.0b7.dist-info/METADATA,sha256=RNKH0xkVnw06eSlXOfiad-MEcEfrii1_9W7EeQRb9L4,4813
|
|
165
|
+
web3-7.0.0b7.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
|
166
|
+
web3-7.0.0b7.dist-info/top_level.txt,sha256=iwupuJh7wgypXrpk_awszyri3TahRr5vxSphNyvt1bU,9
|
|
167
|
+
web3-7.0.0b7.dist-info/RECORD,,
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Generated by `compile_contract_sources.py` script.
|
|
3
|
-
Compiled with Solidity v0.8.17.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
# source: web3/_utils/contract_sources/AddressReflector.sol:AddressReflector
|
|
7
|
-
ADDRESS_REFLECTOR_BYTECODE = "0x608060405234801561001057600080fd5b50610430806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630b816c161461003b578063c04d11fc1461006b575b600080fd5b61005560048036038101906100509190610121565b61009b565b604051610062919061015d565b60405180910390f35b610085600480360381019061008091906102d1565b6100a5565b60405161009291906103d8565b60405180910390f35b6000819050919050565b6060819050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100ee826100c3565b9050919050565b6100fe816100e3565b811461010957600080fd5b50565b60008135905061011b816100f5565b92915050565b600060208284031215610137576101366100b9565b5b60006101458482850161010c565b91505092915050565b610157816100e3565b82525050565b6000602082019050610172600083018461014e565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c68261017d565b810181811067ffffffffffffffff821117156101e5576101e461018e565b5b80604052505050565b60006101f86100af565b905061020482826101bd565b919050565b600067ffffffffffffffff8211156102245761022361018e565b5b602082029050602081019050919050565b600080fd5b600061024d61024884610209565b6101ee565b905080838252602082019050602084028301858111156102705761026f610235565b5b835b818110156102995780610285888261010c565b845260208401935050602081019050610272565b5050509392505050565b600082601f8301126102b8576102b7610178565b5b81356102c884826020860161023a565b91505092915050565b6000602082840312156102e7576102e66100b9565b5b600082013567ffffffffffffffff811115610305576103046100be565b5b610311848285016102a3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61034f816100e3565b82525050565b60006103618383610346565b60208301905092915050565b6000602082019050919050565b60006103858261031a565b61038f8185610325565b935061039a83610336565b8060005b838110156103cb5781516103b28882610355565b97506103bd8361036d565b92505060018101905061039e565b5085935050505092915050565b600060208201905081810360008301526103f2818461037a565b90509291505056fea264697066735822122035083763a0f4c4f5a71055f0da2f3d4f78e64159a8f3bc215c430daec7ac5e2064736f6c63430008110033" # noqa: E501
|
|
8
|
-
ADDRESS_REFLECTOR_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630b816c161461003b578063c04d11fc1461006b575b600080fd5b61005560048036038101906100509190610121565b61009b565b604051610062919061015d565b60405180910390f35b610085600480360381019061008091906102d1565b6100a5565b60405161009291906103d8565b60405180910390f35b6000819050919050565b6060819050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100ee826100c3565b9050919050565b6100fe816100e3565b811461010957600080fd5b50565b60008135905061011b816100f5565b92915050565b600060208284031215610137576101366100b9565b5b60006101458482850161010c565b91505092915050565b610157816100e3565b82525050565b6000602082019050610172600083018461014e565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c68261017d565b810181811067ffffffffffffffff821117156101e5576101e461018e565b5b80604052505050565b60006101f86100af565b905061020482826101bd565b919050565b600067ffffffffffffffff8211156102245761022361018e565b5b602082029050602081019050919050565b600080fd5b600061024d61024884610209565b6101ee565b905080838252602082019050602084028301858111156102705761026f610235565b5b835b818110156102995780610285888261010c565b845260208401935050602081019050610272565b5050509392505050565b600082601f8301126102b8576102b7610178565b5b81356102c884826020860161023a565b91505092915050565b6000602082840312156102e7576102e66100b9565b5b600082013567ffffffffffffffff811115610305576103046100be565b5b610311848285016102a3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61034f816100e3565b82525050565b60006103618383610346565b60208301905092915050565b6000602082019050919050565b60006103858261031a565b61038f8185610325565b935061039a83610336565b8060005b838110156103cb5781516103b28882610355565b97506103bd8361036d565b92505060018101905061039e565b5085935050505092915050565b600060208201905081810360008301526103f2818461037a565b90509291505056fea264697066735822122035083763a0f4c4f5a71055f0da2f3d4f78e64159a8f3bc215c430daec7ac5e2064736f6c63430008110033" # noqa: E501
|
|
9
|
-
ADDRESS_REFLECTOR_ABI = [
|
|
10
|
-
{
|
|
11
|
-
"inputs": [{"internalType": "address", "name": "arg", "type": "address"}],
|
|
12
|
-
"name": "reflect",
|
|
13
|
-
"outputs": [{"internalType": "address", "name": "", "type": "address"}],
|
|
14
|
-
"stateMutability": "pure",
|
|
15
|
-
"type": "function",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"inputs": [{"internalType": "address[]", "name": "arg", "type": "address[]"}],
|
|
19
|
-
"name": "reflect",
|
|
20
|
-
"outputs": [{"internalType": "address[]", "name": "", "type": "address[]"}],
|
|
21
|
-
"stateMutability": "pure",
|
|
22
|
-
"type": "function",
|
|
23
|
-
},
|
|
24
|
-
]
|
|
25
|
-
ADDRESS_REFLECTOR_DATA = {
|
|
26
|
-
"bytecode": ADDRESS_REFLECTOR_BYTECODE,
|
|
27
|
-
"bytecode_runtime": ADDRESS_REFLECTOR_RUNTIME,
|
|
28
|
-
"abi": ADDRESS_REFLECTOR_ABI,
|
|
29
|
-
}
|
web3/_utils/request.py
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
from concurrent.futures import (
|
|
3
|
-
ThreadPoolExecutor,
|
|
4
|
-
)
|
|
5
|
-
import logging
|
|
6
|
-
import os
|
|
7
|
-
import threading
|
|
8
|
-
from typing import (
|
|
9
|
-
Any,
|
|
10
|
-
Dict,
|
|
11
|
-
List,
|
|
12
|
-
Optional,
|
|
13
|
-
Union,
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
from aiohttp import (
|
|
17
|
-
ClientResponse,
|
|
18
|
-
ClientSession,
|
|
19
|
-
ClientTimeout,
|
|
20
|
-
)
|
|
21
|
-
from eth_typing import (
|
|
22
|
-
URI,
|
|
23
|
-
)
|
|
24
|
-
import requests
|
|
25
|
-
|
|
26
|
-
from web3._utils.async_caching import (
|
|
27
|
-
async_lock,
|
|
28
|
-
)
|
|
29
|
-
from web3._utils.caching import (
|
|
30
|
-
generate_cache_key,
|
|
31
|
-
)
|
|
32
|
-
from web3.utils.caching import (
|
|
33
|
-
SimpleCache,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
logger = logging.getLogger(__name__)
|
|
37
|
-
|
|
38
|
-
DEFAULT_TIMEOUT = 30
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def get_default_http_endpoint() -> URI:
|
|
42
|
-
return URI(os.environ.get("WEB3_HTTP_PROVIDER_URI", "http://localhost:8545"))
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
_session_cache = SimpleCache()
|
|
46
|
-
_session_cache_lock = threading.Lock()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def cache_and_return_session(
|
|
50
|
-
endpoint_uri: URI, session: requests.Session = None
|
|
51
|
-
) -> requests.Session:
|
|
52
|
-
# cache key should have a unique thread identifier
|
|
53
|
-
cache_key = generate_cache_key(f"{threading.get_ident()}:{endpoint_uri}")
|
|
54
|
-
|
|
55
|
-
cached_session = _session_cache.get_cache_entry(cache_key)
|
|
56
|
-
if cached_session is not None:
|
|
57
|
-
# If read from cache yields a session, no need to lock; return the session.
|
|
58
|
-
# Sync is a bit simpler in this way since a `requests.Session` doesn't really
|
|
59
|
-
# "close" in the same way that an async `ClientSession` does. When "closed", it
|
|
60
|
-
# still uses http / https adapters successfully if a request is made.
|
|
61
|
-
return cached_session
|
|
62
|
-
|
|
63
|
-
if session is None:
|
|
64
|
-
session = requests.Session()
|
|
65
|
-
|
|
66
|
-
with _session_cache_lock:
|
|
67
|
-
cached_session, evicted_items = _session_cache.cache(cache_key, session)
|
|
68
|
-
logger.debug(f"Session cached: {endpoint_uri}, {cached_session}")
|
|
69
|
-
|
|
70
|
-
if evicted_items is not None:
|
|
71
|
-
evicted_sessions = evicted_items.values()
|
|
72
|
-
for evicted_session in evicted_sessions:
|
|
73
|
-
logger.debug(
|
|
74
|
-
f"Session cache full. Session evicted from cache: {evicted_session}",
|
|
75
|
-
)
|
|
76
|
-
threading.Timer(
|
|
77
|
-
DEFAULT_TIMEOUT + 0.1,
|
|
78
|
-
_close_evicted_sessions,
|
|
79
|
-
args=[evicted_sessions],
|
|
80
|
-
).start()
|
|
81
|
-
|
|
82
|
-
return cached_session
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def get_response_from_get_request(
|
|
86
|
-
endpoint_uri: URI, *args: Any, **kwargs: Any
|
|
87
|
-
) -> requests.Response:
|
|
88
|
-
kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
|
|
89
|
-
session = cache_and_return_session(endpoint_uri)
|
|
90
|
-
response = session.get(endpoint_uri, *args, **kwargs)
|
|
91
|
-
return response
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def json_make_get_request(
|
|
95
|
-
endpoint_uri: URI, *args: Any, **kwargs: Any
|
|
96
|
-
) -> Dict[str, Any]:
|
|
97
|
-
response = get_response_from_get_request(endpoint_uri, *args, **kwargs)
|
|
98
|
-
response.raise_for_status()
|
|
99
|
-
return response.json()
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
def get_response_from_post_request(
|
|
103
|
-
endpoint_uri: URI, *args: Any, **kwargs: Any
|
|
104
|
-
) -> requests.Response:
|
|
105
|
-
kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
|
|
106
|
-
session = cache_and_return_session(endpoint_uri)
|
|
107
|
-
response = session.post(endpoint_uri, *args, **kwargs)
|
|
108
|
-
return response
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def make_post_request(
|
|
112
|
-
endpoint_uri: URI, data: Union[bytes, Dict[str, Any]], **kwargs: Any
|
|
113
|
-
) -> bytes:
|
|
114
|
-
response = get_response_from_post_request(endpoint_uri, data=data, **kwargs)
|
|
115
|
-
response.raise_for_status()
|
|
116
|
-
return response.content
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
def _close_evicted_sessions(evicted_sessions: List[requests.Session]) -> None:
|
|
120
|
-
for evicted_session in evicted_sessions:
|
|
121
|
-
evicted_session.close()
|
|
122
|
-
logger.debug(f"Closed evicted session: {evicted_session}")
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
# --- async --- #
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
_async_session_cache = SimpleCache()
|
|
129
|
-
_async_session_cache_lock = threading.Lock()
|
|
130
|
-
_async_session_pool = ThreadPoolExecutor(max_workers=1)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
async def async_cache_and_return_session(
|
|
134
|
-
endpoint_uri: URI,
|
|
135
|
-
session: Optional[ClientSession] = None,
|
|
136
|
-
) -> ClientSession:
|
|
137
|
-
# cache key should have a unique thread identifier
|
|
138
|
-
cache_key = generate_cache_key(f"{threading.get_ident()}:{endpoint_uri}")
|
|
139
|
-
|
|
140
|
-
evicted_items = None
|
|
141
|
-
async with async_lock(_async_session_pool, _async_session_cache_lock):
|
|
142
|
-
if cache_key not in _async_session_cache:
|
|
143
|
-
if session is None:
|
|
144
|
-
session = ClientSession(raise_for_status=True)
|
|
145
|
-
|
|
146
|
-
cached_session, evicted_items = _async_session_cache.cache(
|
|
147
|
-
cache_key, session
|
|
148
|
-
)
|
|
149
|
-
logger.debug(f"Async session cached: {endpoint_uri}, {cached_session}")
|
|
150
|
-
|
|
151
|
-
else:
|
|
152
|
-
# get the cached session
|
|
153
|
-
cached_session = _async_session_cache.get_cache_entry(cache_key)
|
|
154
|
-
session_is_closed = cached_session.closed
|
|
155
|
-
session_loop_is_closed = cached_session._loop.is_closed()
|
|
156
|
-
|
|
157
|
-
warning = (
|
|
158
|
-
"Async session was closed"
|
|
159
|
-
if session_is_closed
|
|
160
|
-
else (
|
|
161
|
-
"Loop was closed for async session"
|
|
162
|
-
if session_loop_is_closed
|
|
163
|
-
else None
|
|
164
|
-
)
|
|
165
|
-
)
|
|
166
|
-
if warning:
|
|
167
|
-
logger.debug(
|
|
168
|
-
f"{warning}: {endpoint_uri}, {cached_session}. "
|
|
169
|
-
f"Creating and caching a new async session for uri."
|
|
170
|
-
)
|
|
171
|
-
|
|
172
|
-
_async_session_cache._data.pop(cache_key)
|
|
173
|
-
if not session_is_closed:
|
|
174
|
-
# if loop was closed but not the session, close the session
|
|
175
|
-
await cached_session.close()
|
|
176
|
-
logger.debug(
|
|
177
|
-
f"Async session closed and evicted from cache: {cached_session}"
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
# replace stale session with a new session at the cache key
|
|
181
|
-
_session = ClientSession(raise_for_status=True)
|
|
182
|
-
cached_session, evicted_items = _async_session_cache.cache(
|
|
183
|
-
cache_key, _session
|
|
184
|
-
)
|
|
185
|
-
logger.debug(f"Async session cached: {endpoint_uri}, {cached_session}")
|
|
186
|
-
|
|
187
|
-
if evicted_items is not None:
|
|
188
|
-
# At this point the evicted sessions are already popped out of the cache and
|
|
189
|
-
# just stored in the `evicted_sessions` dict. So we can kick off a future task
|
|
190
|
-
# to close them and it should be safe to pop out of the lock here.
|
|
191
|
-
evicted_sessions = evicted_items.values()
|
|
192
|
-
for evicted_session in evicted_sessions:
|
|
193
|
-
logger.debug(
|
|
194
|
-
"Async session cache full. Session evicted from cache: "
|
|
195
|
-
f"{evicted_session}",
|
|
196
|
-
)
|
|
197
|
-
# Kick off a future task, in a separate thread, to close the evicted
|
|
198
|
-
# sessions. In the case that the cache filled very quickly and some
|
|
199
|
-
# sessions have been evicted before their original request has been made,
|
|
200
|
-
# we set the timer to a bit more than the `DEFAULT_TIMEOUT` for a call. This
|
|
201
|
-
# should make it so that any call from an evicted session can still be made
|
|
202
|
-
# before the session is closed.
|
|
203
|
-
threading.Timer(
|
|
204
|
-
DEFAULT_TIMEOUT + 0.1,
|
|
205
|
-
_async_close_evicted_sessions,
|
|
206
|
-
args=[evicted_sessions],
|
|
207
|
-
).start()
|
|
208
|
-
|
|
209
|
-
return cached_session
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
async def async_get_response_from_get_request(
|
|
213
|
-
endpoint_uri: URI, *args: Any, **kwargs: Any
|
|
214
|
-
) -> ClientResponse:
|
|
215
|
-
kwargs.setdefault("timeout", ClientTimeout(DEFAULT_TIMEOUT))
|
|
216
|
-
session = await async_cache_and_return_session(endpoint_uri)
|
|
217
|
-
response = await session.get(endpoint_uri, *args, **kwargs)
|
|
218
|
-
return response
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
async def async_json_make_get_request(
|
|
222
|
-
endpoint_uri: URI, *args: Any, **kwargs: Any
|
|
223
|
-
) -> Dict[str, Any]:
|
|
224
|
-
response = await async_get_response_from_get_request(endpoint_uri, *args, **kwargs)
|
|
225
|
-
response.raise_for_status()
|
|
226
|
-
return await response.json()
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
async def async_get_response_from_post_request(
|
|
230
|
-
endpoint_uri: URI, *args: Any, **kwargs: Any
|
|
231
|
-
) -> ClientResponse:
|
|
232
|
-
kwargs.setdefault("timeout", ClientTimeout(DEFAULT_TIMEOUT))
|
|
233
|
-
session = await async_cache_and_return_session(endpoint_uri)
|
|
234
|
-
response = await session.post(endpoint_uri, *args, **kwargs)
|
|
235
|
-
return response
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
async def async_make_post_request(
|
|
239
|
-
endpoint_uri: URI, data: Union[bytes, Dict[str, Any]], **kwargs: Any
|
|
240
|
-
) -> bytes:
|
|
241
|
-
response = await async_get_response_from_post_request(
|
|
242
|
-
endpoint_uri, data=data, **kwargs
|
|
243
|
-
)
|
|
244
|
-
response.raise_for_status()
|
|
245
|
-
return await response.read()
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
async def async_get_json_from_client_response(
|
|
249
|
-
response: ClientResponse,
|
|
250
|
-
) -> Dict[str, Any]:
|
|
251
|
-
return await response.json()
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
def _async_close_evicted_sessions(evicted_sessions: List[ClientSession]) -> None:
|
|
255
|
-
loop = asyncio.new_event_loop()
|
|
256
|
-
|
|
257
|
-
for evicted_session in evicted_sessions:
|
|
258
|
-
loop.run_until_complete(evicted_session.close())
|
|
259
|
-
logger.debug(f"Closed evicted async session: {evicted_session}")
|
|
260
|
-
|
|
261
|
-
if any(not evicted_session.closed for evicted_session in evicted_sessions):
|
|
262
|
-
logger.warning(
|
|
263
|
-
f"Some evicted async sessions were not properly closed: {evicted_sessions}"
|
|
264
|
-
)
|
|
265
|
-
loop.close()
|
|
File without changes
|
|
File without changes
|