From d65865a26cfcd94e4bdb4a841a5104de2435f6ce Mon Sep 17 00:00:00 2001 From: Ghost <62809003+Ghost6446@users.noreply.github.com> Date: Thu, 2 May 2024 17:09:07 +0200 Subject: [PATCH] Add note for mac --- Src/Api/site.py | 11 ++++------- Src/Lib/Request/my_requests.py | 1 + 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Src/Api/site.py b/Src/Api/site.py index 47f1695..a570fd5 100644 --- a/Src/Api/site.py +++ b/Src/Api/site.py @@ -42,11 +42,8 @@ def get_token(site_name: str, domain: str) -> dict: The keys are 'XSRF_TOKEN', 'animeunity_session', and 'csrf_token'. """ - # Create a session object to handle the HTTP request and response - session = requests.Session() - # Send a GET request to the specified URL composed of the site name and domain - response = session.get(f"https://www.{site_name}.{domain}") + response = requests.get(f"https://www.{site_name}.{domain}") # Initialize variables to store CSRF token find_csrf_token = None @@ -64,8 +61,8 @@ def get_token(site_name: str, domain: str) -> dict: find_csrf_token = html_meta.get('content') return { - 'XSRF_TOKEN': session.cookies['XSRF-TOKEN'], - 'animeunity_session': session.cookies['animeunity_session'], + 'XSRF_TOKEN': response.cookies['XSRF-TOKEN'], + 'animeunity_session': response.cookies['animeunity_session'], 'csrf_token': find_csrf_token } @@ -326,7 +323,7 @@ def anime_search(title_search: str) -> int: } # Send a POST request to the API endpoint for live search - response = requests.post(f'https://www.{url_site_name}.{url_domain}/livesearch', cookies=cookies, headers=headers, json=json_data) + response = requests.post(f'https://www.{url_site_name}.{url_domain}/livesearch', cookies=cookies, headers=headers, json_data=json_data) # Process each record returned in the response for record in response.json()['records']: diff --git a/Src/Lib/Request/my_requests.py b/Src/Lib/Request/my_requests.py index 8ebcfb8..e4058e2 100644 --- a/Src/Lib/Request/my_requests.py +++ b/Src/Lib/Request/my_requests.py @@ -1,4 +1,5 @@ # 04.4.24 +# Note: verify_ssl need to be set to false for macOs import base64 import json