Internal server error
-
@admin
I am facing issues while using API
Internal server error occurs almost on an alternative day.
And that is interrupting my algorithm while giving API calls for order placement, RMS limits, and so on.Please suggest, why this error is occurring? and how it can be handled in code?
Below I am attaching error traceback-
INFO:2021-08-10 13:24:11,226:MainThread:exception in place_new_orders : Couldn't parse the JSON response received from the server: b'<!doctype html><html lang="en"><head><title>HTTP Status 500 \xe2\x80\x93 Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 \xe2\x80\x93 Internal Server Error</h1></body></html>'
-
HI @leena-1234 This issue has been resolved.
-
@admin
The error has occurred yesterday only.
When this error has been solved?
Also let me know if I need to change anything in current API or scripts?detailed error log is as below -
ERROR:2021-08-10 13:21:20,027:MainThread:exception in get_rms_limit() Couldn't parse the JSON response received from the server: b'<!doctype html><html lang="en"><head><title>HTTP Status 500 \xe2\x80\x93 Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 \xe2\x80\x93 Internal Server Error</h1></body></html>'
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\smartapi\smartConnect.py", line 188, in request
data = json.loads(r.content.decode("utf8"))
File "C:\ProgramData\Anaconda3\lib\json_init.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\ProgramData\Anaconda3\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\ProgramData\Anaconda3\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "order.py", line 237, in get_rms_limit
File "C:\ProgramData\Anaconda3\lib\site-packages\smartapi\smartConnect.py", line 327, in rmsLimit
rmsLimitResponse= self._getRequest("api.rms.limit")
File "C:\ProgramData\Anaconda3\lib\site-packages\smartapi\smartConnect.py", line 223, in _getRequest
return self._request(route, "GET", params)
File "C:\ProgramData\Anaconda3\lib\site-packages\smartapi\smartConnect.py", line 191, in _request
raise ex.DataException("Couldn't parse the JSON response received from the server: {content}".format(
smartapi.smartExceptions.DataException: Couldn't parse the JSON response received from the server: b'<!doctype html><html lang="en"><head><title>HTTP Status 500 \xe2\x80\x93 Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 \xe2\x80\x93 Internal Server Error</h1></body></html>' -
@admin
Any update on my query? -
HI @leena-1234 This issue has been fixed.
Kindly post your client id here. -
Hi @leena-1234 , these errors are very frequent and you need to make your script robust. Previously these errors used to come once every week. But this time from past 3 days daily these are coming and no one knows what are the reasons.
Improve your code and make it robust to such errors. -
-
HI @lakshmi_73 said in Internal server error:
Hi @leena-1234 , these errors are very frequent and you need to make your script robust. Previously these errors used to come once every week. But this time from past 3 days daily these are coming and no one knows what are the reasons.
Improve your code and make it robust to such errors.Did you faced this issue in the morning today.?
-
@admin Yes admin not exactly same issue but yeah couldnot fetch any details or place orders,
https://smartapi.angelbroking.com/topic/1222/internal-server-error
pls refer above thread. -
HI @lakshmi_73 This issue has been resolved.
-
@admin Thank You
-
HI @lakshmi_73 Please let us know if you face any other issue or same issue again.