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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sparq
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Python client for the sparq api - automated degree planning for SJSU students + more
5
5
  Author-email: Shiven Sheth <shivsbots@gmail.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sparq"
7
- version = "0.1.4"
7
+ version = "0.1.5"
8
8
  authors = [
9
9
  { name="Shiven Sheth", email="shivsbots@gmail.com" }
10
10
  ]
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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sparq
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Python client for the sparq api - automated degree planning for SJSU students + more
5
5
  Author-email: Shiven Sheth <shivsbots@gmail.com>
6
6
  License-Expression: MIT
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