Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
VirusNoirrr committed May 7, 2024
1 parent 6f135eb commit c46b309
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ProCap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
class Task:
def __init__(self, response: dict) -> None:
self.id = response.get("taskId")
self.captchaType = response.get("captchaType")
self.time = response.get("time")
self.success = response.get("success")
self.error = response.get("error")
self.status = response.get("status")
self.token = response.get("solution").get("generated_pass_uuid")
self.token = response.get("solution").get("generated_pass_uuid") if self.captchaType == "hCaptchaTask" else response.get("solution")
self.challengeKey = response.get("solution").get("challenge_key")
self.response = response

Expand All @@ -24,14 +25,14 @@ class ProCap:
def __init__(self, apikey) -> None:
self.apikey = apikey
def get_balance(self):
request = requests.get("https://api.procap.wtf/user")
request = requests.get("http://api.procap.wtf/user")
return User(request.json())
def createTask(self, url=None, sitekey=None, proxy=None, userAgent=None, rqdata=None, isEnterprise=False, type="hCaptchaTask"):
payload = {
"clientKey": self.apikey,
"task": {
"type": type,
"href":url,
"href" if type == "hCaptchaTask" else "pjs": url,
"sitekey": sitekey,
"proxy": proxy,
"useragent": userAgent,
Expand All @@ -40,11 +41,12 @@ def createTask(self, url=None, sitekey=None, proxy=None, userAgent=None, rqdata=
}
if "hcaptcha" in type and isEnterprise:
payload.update({"isEnterprise": isEnterprise})
request = requests.post("https://api.procap.wtf/createTask", json=payload).json()
request = requests.post("http://api.procap.wtf/createTask", json=payload)
request = request.json()
request["solution"] = {}
return Task(request)
def checkTask(self, id):
request = requests.get("https://api.procap.wtf/checkTask", json={
request = requests.get("http://api.procap.wtf/checkTask", json={
"clientKey": self.apikey,
"taskId": id
})
Expand Down

0 comments on commit c46b309

Please sign in to comment.