Skip to content

Commit

Permalink
Merge pull request #5 from LarkinZero/master
Browse files Browse the repository at this point in the history
Add apr_root support
  • Loading branch information
lupohan44 authored Nov 14, 2024
2 parents 2676295 + f63bacd commit a5b8e99
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions PyCookieCloud/PyCookieCloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import hashlib
import json
from typing import Optional, Dict, List, Any
from urllib.parse import urljoin
from urllib.parse import urljoin,urlparse
from pathlib import PurePosixPath

import requests

Expand All @@ -14,6 +15,7 @@ def __init__(self, url: str, uuid: str, password: str):
self.url: str = url
self.uuid: str = uuid
self.password: str = password
self.api_root: str = urlparse(url).path if urlparse(url).path else '/'

def check_connection(self) -> bool:
"""
Expand All @@ -37,7 +39,8 @@ def get_encrypted_data(self) -> Optional[str]:
:return: The encrypted data if the connection is successful, None otherwise.
"""
if self.check_connection():
cookie_cloud_request = requests.get(urljoin(self.url, 'get/' + self.uuid))
path = str(PurePosixPath(self.api_root, 'get/', self.uuid))
cookie_cloud_request = requests.get(urljoin(self.url, path))
if cookie_cloud_request.status_code == 200:
cookie_cloud_response = cookie_cloud_request.json()
encrypted_data = cookie_cloud_response["encrypted"]
Expand Down

0 comments on commit a5b8e99

Please sign in to comment.