mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-09-21 16:33:22 +00:00
12 lines
295 B
Python
12 lines
295 B
Python
from base64 import b64encode
|
|
|
|
from . import Captcha
|
|
from ..api import APIView
|
|
|
|
|
|
class CaptchaAPIView(APIView):
|
|
def get(self, request):
|
|
img_prefix = "data:image/png;base64,"
|
|
img = img_prefix + b64encode(Captcha(request).get()).decode("utf-8")
|
|
return self.success(img)
|