sparq 0.1.4__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sparq-0.1.4/sparq.egg-info → sparq-0.1.5}/PKG-INFO +1 -1
- {sparq-0.1.4 → sparq-0.1.5}/pyproject.toml +1 -1
- sparq-0.1.5/recover.py +61 -0
- {sparq-0.1.4 → sparq-0.1.5/sparq.egg-info}/PKG-INFO +1 -1
- sparq-0.1.4/recover.py +0 -54
- {sparq-0.1.4 → sparq-0.1.5}/LICENSE +0 -0
- {sparq-0.1.4 → sparq-0.1.5}/README.md +0 -0
- {sparq-0.1.4 → sparq-0.1.5}/auth.py +0 -0
- {sparq-0.1.4 → sparq-0.1.5}/client.py +0 -0
- {sparq-0.1.4 → sparq-0.1.5}/setup.cfg +0 -0
- {sparq-0.1.4 → sparq-0.1.5}/sparq.egg-info/SOURCES.txt +0 -0
- {sparq-0.1.4 → sparq-0.1.5}/sparq.egg-info/dependency_links.txt +0 -0
- {sparq-0.1.4 → sparq-0.1.5}/sparq.egg-info/requires.txt +0 -0
- {sparq-0.1.4 → sparq-0.1.5}/sparq.egg-info/top_level.txt +0 -0
- {sparq-0.1.4 → sparq-0.1.5}/usage.py +0 -0
sparq-0.1.5/recover.py
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
|
3
|
+
import requests
|
4
|
+
from pathlib import Path
|
5
|
+
|
6
|
+
API_URL = "https://sparq-api.onrender.com"
|
7
|
+
|
8
|
+
def save_api_key(api_key, email):
|
9
|
+
config_dir = Path.home() / ".sparq"
|
10
|
+
config_dir.mkdir(exist_ok=True)
|
11
|
+
config_file = config_dir / "config.txt"
|
12
|
+
|
13
|
+
with open(config_file, "w") as f:
|
14
|
+
f.write(f"API_KEY={api_key}\n")
|
15
|
+
f.write(f"EMAIL={email}\n")
|
16
|
+
|
17
|
+
print(f"\nAPI key saved to {config_file}")
|
18
|
+
|
19
|
+
def recover():
|
20
|
+
email = input("Email: ").strip()
|
21
|
+
|
22
|
+
if not email or "@" not in email:
|
23
|
+
print("Invalid email address")
|
24
|
+
return
|
25
|
+
|
26
|
+
try:
|
27
|
+
response = requests.post(
|
28
|
+
f"{API_URL}/recover",
|
29
|
+
json={"email": email},
|
30
|
+
headers={"Content-Type": "application/json"}
|
31
|
+
)
|
32
|
+
|
33
|
+
if response.status_code != 200:
|
34
|
+
print(f"Error: {response.json().get('detail', 'Unknown error')}")
|
35
|
+
return
|
36
|
+
|
37
|
+
print("Verification code sent to your email")
|
38
|
+
except Exception as e:
|
39
|
+
print(f"Error connecting to API: {e}")
|
40
|
+
return
|
41
|
+
|
42
|
+
code = input("Enter code: ").strip()
|
43
|
+
|
44
|
+
try:
|
45
|
+
response = requests.post(
|
46
|
+
f"{API_URL}/recover",
|
47
|
+
json={"email": email, "code": code},
|
48
|
+
headers={"Content-Type": "application/json"}
|
49
|
+
)
|
50
|
+
|
51
|
+
if response.status_code == 200:
|
52
|
+
api_key = response.json()["api_key"]
|
53
|
+
print(f"\nAPI Key: {api_key}")
|
54
|
+
save_api_key(api_key, email)
|
55
|
+
else:
|
56
|
+
print(f"Error: {response.json().get('detail', 'Unknown error')}")
|
57
|
+
except Exception as e:
|
58
|
+
print(f"Error connecting to API: {e}")
|
59
|
+
|
60
|
+
if __name__ == "__main__":
|
61
|
+
recover()
|
sparq-0.1.4/recover.py
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
|
3
|
-
import requests
|
4
|
-
from pathlib import Path
|
5
|
-
|
6
|
-
API_URL = "https://sparq-api.onrender.com"
|
7
|
-
|
8
|
-
def save_api_key(api_key, email):
|
9
|
-
config_dir = Path.home() / ".sparq"
|
10
|
-
config_dir.mkdir(exist_ok=True)
|
11
|
-
config_file = config_dir / "config.txt"
|
12
|
-
|
13
|
-
with open(config_file, "w") as f:
|
14
|
-
f.write(f"API_KEY={api_key}\n")
|
15
|
-
f.write(f"EMAIL={email}\n")
|
16
|
-
|
17
|
-
print(f"\nAPI key saved to {config_file}")
|
18
|
-
|
19
|
-
def recover():
|
20
|
-
email = input("Email: ").strip()
|
21
|
-
|
22
|
-
if not email or "@" not in email:
|
23
|
-
print("Invalid email address")
|
24
|
-
return
|
25
|
-
|
26
|
-
response = requests.post(
|
27
|
-
f"{API_URL}/recover",
|
28
|
-
json={"email": email},
|
29
|
-
headers={"Content-Type": "application/json"}
|
30
|
-
)
|
31
|
-
|
32
|
-
if response.status_code != 200:
|
33
|
-
print(response.json()['detail'])
|
34
|
-
return
|
35
|
-
|
36
|
-
print("Verification code sent to your email")
|
37
|
-
|
38
|
-
code = input("Enter code: ").strip()
|
39
|
-
|
40
|
-
response = requests.post(
|
41
|
-
f"{API_URL}/recover",
|
42
|
-
json={"email": email, "code": code},
|
43
|
-
headers={"Content-Type": "application/json"}
|
44
|
-
)
|
45
|
-
|
46
|
-
if response.status_code == 200:
|
47
|
-
api_key = response.json()["api_key"]
|
48
|
-
print(f"\nAPI Key: {api_key}")
|
49
|
-
save_api_key(api_key, email)
|
50
|
-
else:
|
51
|
-
print(response.json()['detail'])
|
52
|
-
|
53
|
-
if __name__ == "__main__":
|
54
|
-
recover()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|