Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
VirusNoirrr authored Mar 11, 2024
1 parent ddfba25 commit 6bc2415
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions ProCap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,23 @@ def __init__(self, response: dict) -> None:
self.success = response.get("Success")
self.token = response["Results"].get("Pass")
self.challengeKey = response["Results"].get("ChallengeKey")
self.response = response
class User:
def __init__(self, response: dict) -> None:
self.balance = response.get("balance")
self.daily_limit = response.get("daily_limit")
self.next_reset = response.get("next_reset")
self.daily_used = response.get("daily_used")
self.daily_remaining = response.get("daily_remaining")
self.plan_expire = response.get("plan_expire")
self.response = response
class ProCap:
def __init__(self, apikey) -> None:
self.apikey = apikey
self.headers = {"apikey": apikey}
def get_balance(self):
request = requests.get("https://api.procap.wtf/balance", headers=self.headers)
js = request.json()
balance = js.get("balance")
return balance if balance != None else js.get("error")
request = requests.get("https://api.procap.wtf/user", headers=self.headers)
return User(request.json())
def createTask(self, url, sitekey, proxy=None, userAgent=None, rqdata=None):
payload = {
"url": url,
Expand All @@ -43,6 +51,6 @@ def solve(self, url, sitekey, proxy=None, userAgent=None, rqdata=None):
captcha_challenge = self.checkTask(task.id)
if captcha_challenge.message != "solving" and captcha_challenge.message != "solved":
return None
if captcha_challenge.token:
if captcha_challenge.message == "solved":
return captcha_challenge.token
time.sleep(1)

0 comments on commit 6bc2415

Please sign in to comment.