Skip to content

Commit

Permalink
Fixed 2FA
Browse files Browse the repository at this point in the history
  • Loading branch information
UltimaHoarder committed Jul 2, 2021
1 parent 7e215e2 commit 343db20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion apis/api_helper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import copy
import hashlib
import json
import os
import re
import threading
Expand Down Expand Up @@ -164,6 +165,8 @@ async def json_request(
headers = self.session_rules(link)
headers["accept"] = "application/json, text/plain, */*"
headers["Connection"] = "keep-alive"
temp_payload = payload.copy()

request_method = None
result = None
if method == "HEAD":
Expand All @@ -172,13 +175,15 @@ async def json_request(
request_method = session.get
elif method == "POST":
request_method = session.post
headers["content-type"] = "application/json"
temp_payload = json.dumps(payload)
elif method == "DELETE":
request_method = session.delete
else:
return None
while True:
try:
response = await request_method(link, headers=headers, data=payload)
response = await request_method(link, headers=headers, data=temp_payload)
if method == "HEAD":
result = response
else:
Expand Down
9 changes: 5 additions & 4 deletions apis/onlyfans/classes/create_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ async def resolve_auth(auth: create_auth):
response = await self.session_manager.json_request(
link, method="POST", payload=data
)
if "error" in response:
error.message = response["error"]["message"]
if isinstance(response, error_details):
error.message = response.message
count += 1
else:
print("Success")
auth.active = True
auth.active = False
auth.errors.remove(error)
await self.get_authed()
break

await resolve_auth(self)
Expand Down Expand Up @@ -313,7 +314,7 @@ async def multi(item):
continue
link = endpoint_links(identifier=identifier).users
result = await self.session_manager.json_request(link)
if isinstance(result,error_details) or not result["subscribedBy"]:
if isinstance(result, error_details) or not result["subscribedBy"]:
continue
subscription = create_user(result, self)
if subscription.isBlocked:
Expand Down

0 comments on commit 343db20

Please sign in to comment.