forked from miven/1024-Autoreply
-
Notifications
You must be signed in to change notification settings - Fork 1
/
getver.py
47 lines (44 loc) · 1.28 KB
/
getver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from PIL import Image
import requests
import base64
import os
import json
class GetVerificationCode:
@staticmethod
def apitruecaptcha():
im=Image.open("image.webp")
im.save('image.png')
f=open('image.png','rb')
userid = os.environ["USERID"]
apikey = os.environ["APIKEY"]
image=base64.b64encode(f.read())
url='https://api.apitruecaptcha.org/one/gettext'
data={
'data':str(image,'utf-8'),
'userid':userid,
'apikey':apikey
}
result = requests.post(url, json.dumps(data))
res=result.json()
code = res['result']
return code
@staticmethod
def ttshitu():
im=Image.open('image.webp')
im.save('image.png')
f=open('image.png','rb')
image=base64.b64encode(f.read())
host='http://api.ttshitu.com/base64'
headers={
'Content-Type':'application/json;charset=UTF-8'
}
data={
'username': os.environ["CODEUSER"] ,
'password': os.environ["CODEPASS"] ,
'image':image.decode('utf-8')
}
res=requests.post(url=host,data=json.dumps(data))
res=res.text
res=json.loads(res)
res=res['data']['result']
return res