ton-http-api 2.0.63__tar.gz → 2.0.65__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ton-http-api
3
- Version: 2.0.63
3
+ Version: 2.0.65
4
4
  Summary: HTTP API for TON (The Open Network)
5
5
  Home-page: https://github.com/toncenter/ton-http-api
6
6
  Author: K-Dimentional Tree
@@ -23,7 +23,7 @@ Requires-Dist: requests==2.28.0
23
23
  Requires-Dist: ring==0.10.1
24
24
  Requires-Dist: uvicorn==0.17.6
25
25
  Requires-Dist: gunicorn==20.1.0
26
- Requires-Dist: pytonlib==0.0.69
26
+ Requires-Dist: pytonlib==0.0.70
27
27
  Requires-Dist: inject==4.3.1
28
28
  Dynamic: author
29
29
  Dynamic: author-email
@@ -30,7 +30,7 @@ from pyTON.settings import Settings, RedisCacheSettings
30
30
  from pytonlib.utils.address import detect_address as __detect_address, prepare_address as _prepare_address
31
31
  from pytonlib.utils.wallet import wallets as known_wallets, sha256
32
32
  from pytonlib.utils.common import hash_to_hex, hex_to_b64str
33
- from pytonlib import TonlibException
33
+ from pytonlib import TonlibException, TonlibError
34
34
 
35
35
  from loguru import logger
36
36
 
@@ -168,10 +168,12 @@ async def timeout_exception_handler(request, exc):
168
168
 
169
169
 
170
170
  @app.exception_handler(TonlibException)
171
- async def tonlib_error_result_exception_handler(request, exc):
172
- res = TonResponse(ok=False, error=str(exc), code=status.HTTP_500_INTERNAL_SERVER_ERROR)
173
- return JSONResponse(res.dict(exclude_none=True), status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
174
-
171
+ async def tonlib_exception_result_exception_handler(request, exc):
172
+ status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
173
+ if str(exc) == 'Smart contract is not Jetton or NFT':
174
+ status_code = 409
175
+ res = TonResponse(ok=False, error=str(exc), code=status_code)
176
+ return JSONResponse(res.dict(exclude_none=True), status_code=status_code)
175
177
 
176
178
  @app.exception_handler(Exception)
177
179
  async def fastapi_generic_exception_handler(request, exc):
@@ -555,7 +557,10 @@ async def get_token_data(
555
557
  Get NFT or Jetton information.
556
558
  """
557
559
  address = prepare_address(address)
558
- return await tonlib.get_token_data(address)
560
+ try:
561
+ return await tonlib.get_token_data(address)
562
+ except Exception as exc:
563
+ raise TonlibException(exc)
559
564
 
560
565
  @app.get('/tryLocateTx', response_model=TonResponse, response_model_exclude_none=True, tags=['transactions'])
561
566
  @json_rpc('tryLocateTx')
@@ -24,7 +24,7 @@ setup(
24
24
  'ring==0.10.1',
25
25
  'uvicorn==0.17.6',
26
26
  'gunicorn==20.1.0',
27
- 'pytonlib==0.0.69',
27
+ 'pytonlib==0.0.70',
28
28
  'inject==4.3.1'
29
29
  ],
30
30
  package_data={},
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ton-http-api
3
- Version: 2.0.63
3
+ Version: 2.0.65
4
4
  Summary: HTTP API for TON (The Open Network)
5
5
  Home-page: https://github.com/toncenter/ton-http-api
6
6
  Author: K-Dimentional Tree
@@ -23,7 +23,7 @@ Requires-Dist: requests==2.28.0
23
23
  Requires-Dist: ring==0.10.1
24
24
  Requires-Dist: uvicorn==0.17.6
25
25
  Requires-Dist: gunicorn==20.1.0
26
- Requires-Dist: pytonlib==0.0.69
26
+ Requires-Dist: pytonlib==0.0.70
27
27
  Requires-Dist: inject==4.3.1
28
28
  Dynamic: author
29
29
  Dynamic: author-email
@@ -6,5 +6,5 @@ requests==2.28.0
6
6
  ring==0.10.1
7
7
  uvicorn==0.17.6
8
8
  gunicorn==20.1.0
9
- pytonlib==0.0.69
9
+ pytonlib==0.0.70
10
10
  inject==4.3.1
File without changes
File without changes