Forums

{"message": "Internal Server Error"}

My language is Korean when i connect here https://dongle21.xyz/check/홍길동/050505/서울/길동고등학교/고등학교/1234/0 it shows "{"message": "Internal Server Error"}"

@api.route('/check/<name>/<string:birth>/<region>/<school>/<level>/<string:password>/<string:selfcheck>', methods=['GET'])  class autocheck(Resource):
    def get(self, name, birth, region,school,level,password,selfcheck):
        print(name)
        print(region)
        print(school)
        print(level)
        data = hcsapi.selfcheck(str(name),birth,str(region),str(school),str(level),password,selfcheck)
        print(name, data)
        con = sqlite3.connect("./fla/User.db")
        cur = con.cursor()
        now = datetime.now()
        current_time = now.strftime("%Y/%m/%d - %H:%M:%S")
        cur.execute("INSERT INTO scl VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", (str(name), str(birth), str(region), str(school), str(level), str(password), str(selfcheck), str(current_time), str(request.remote_addr), str(request.path), str(data)))
        con.commit()
        data = json.dumps(data, ensure_ascii=False)
        data = make_response(data)
        return(data)

error log

2022-09-23 23:32:27,246: [2022-09-23 23:32:27,234] ERROR in app: Exception on /check/홍길동/050505/서울/길동고등학교/고등학교/1234/0 [GET]
2022-09-23 23:32:27,247: Traceback (most recent call last):
2022-09-23 23:32:27,247:   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request
2022-09-23 23:32:27,247:     rv = self.dispatch_request()
2022-09-23 23:32:27,247:   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request
2022-09-23 23:32:27,247:     return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
2022-09-23 23:32:27,247:   File "/home/hellow0709/.local/lib/python3.9/site-packages/flask_restx/api.py", line 403, in wrapper
2022-09-23 23:32:27,247:     resp = resource(*args, **kwargs)
2022-09-23 23:32:27,247:   File "/usr/local/lib/python3.9/site-packages/flask/views.py", line 84, in view
2022-09-23 23:32:27,247:     return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
2022-09-23 23:32:27,247:   File "/home/hellow0709/.local/lib/python3.9/site-packages/flask_restx/resource.py", line 49, in dispatch_request
2022-09-23 23:32:27,248:     resp = meth(*args, **kwargs)
2022-09-23 23:32:27,248:   File "/home/hellow0709/fla/auto.py", line 26, in get
2022-09-23 23:32:27,248:     data = hcsapi.selfcheck(str(name),birth,str(region),str(school),str(level),password,selfcheck)
2022-09-23 23:32:27,248:   File "/home/hellow0709/.local/lib/python3.9/site-packages/hcsapi/hcs.py", line 25, in selfcheck
2022-09-23 23:32:27,248:     return loop.run_until_complete(
2022-09-23 23:32:27,248:   File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
2022-09-23 23:32:27,248:     return future.result()
2022-09-23 23:32:27,248:   File "/home/hellow0709/.local/lib/python3.9/site-packages/hcsapi/hcs.py", line 93, in asyncSelfCheck
2022-09-23 23:32:27,248:     login_result = await asyncUserLogin(
2022-09-23 23:32:27,248:   File "/home/hellow0709/.local/lib/python3.9/site-packages/hcsapi/hcs.py", line 256, in asyncUserLogin
2022-09-23 23:32:27,248:     school_infos = await search_school(
2022-09-23 23:32:27,249:   File "/home/hellow0709/.local/lib/python3.9/site-packages/hcsapi/request.py", line 41, in search_school
2022-09-23 23:32:27,249:     return await resp.json()
2022-09-23 23:32:27,249:   File "/home/hellow0709/.local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1103, in json
2022-09-23 23:32:27,249:     raise ContentTypeError(
2022-09-23 23:32:27,249: aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://hcs.eduro.go.kr/v2/searchSchool?lctnScCode=01&schulCrseScCode=4&orgName=%EA%B8%B8%EB%8F%99%EA%B3%A0%EB%93%B1%ED%95%99%EA%B5%90&loginType=school')
2022-09-23 23:32:27,249: Exception on /check/홍길동/050505/서울/길동고등학교/고등학교/1234/0 [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/hellow0709/.local/lib/python3.9/site-packages/flask_restx/api.py", line 403, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/flask/views.py", line 84, in view
    return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
  File "/home/hellow0709/.local/lib/python3.9/site-packages/flask_restx/resource.py", line 49, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/home/hellow0709/fla/auto.py", line 26, in get
    data = hcsapi.selfcheck(str(name),birth,str(region),str(school),str(level),password,selfcheck)
  File "/home/hellow0709/.local/lib/python3.9/site-packages/hcsapi/hcs.py", line 25, in selfcheck
    return loop.run_until_complete(
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/home/hellow0709/.local/lib/python3.9/site-packages/hcsapi/hcs.py", line 93, in asyncSelfCheck
    enter code here

It looks like you're making a request to a site and trying to decode the result as JSON, but the data that is coming back is HTML. I see that you have a free account; is the site that you're trying to access on the whitelist?

Before I unscribed, it had not worked also.

You could try accessing the site using a library like "requests" and see what it is returning? Sometimes sites will return different responses depending on where the connection comes from -- for example, they might return one response for IPs in one country, and a different one for other countries.