Skip to content

Commit

Permalink
Fixed an issue with csrf token not being extracted correctly
Browse files Browse the repository at this point in the history
Fixed Could not login: 'NoneType' object has no attribute 'get'
  • Loading branch information
Anas Yaseen committed Dec 26, 2023
1 parent f7b17cb commit 5854014
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions pyinstalive/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ def get_shared_data(data):
match_str = match.group(1)
return json.loads(match_str).get("config")
else:
match = re.search(r"\"raw\":\"({[^\n]*\\\"})", data)
if match:
match_str = string_escape(match.group(1))
return json.loads(match_str)
csrf_token = re.search(r'"csrf_token":\s*"([^"]+)"', data)
if csrf_token:
csrf_token_value = csrf_token.group(1)
response = {"csrf_token": csrf_token_value}
return response

def lock_exists():
return os.path.isfile(os.path.join(globals.config.download_path, globals.download.download_user + '.lock'))
Expand Down Expand Up @@ -298,4 +299,4 @@ def remove_temp_folder():
try:
shutil.rmtree(globals.download.segments_path)
except Exception as e:
logger.error("Could not remove segment folder: {:s}".format(str(e)))
logger.error("Could not remove segment folder: {:s}".format(str(e)))
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
argparse>=1.4.0
configparser>=4.0.2
configparser>=4.0.2
requests==2.30.0

0 comments on commit 5854014

Please sign in to comment.