Qwael 4.0.4.4__tar.gz → 4.0.4.6__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: Qwael
3
- Version: 4.0.4.4
3
+ Version: 4.0.4.6
4
4
  Summary: Qwael: İşlevsel ve kolaylaştırılmış Python kütüphanesi
5
5
  Author: Bedirhan
6
6
  Author-email: bedirhan.oytpass@gmail.com
@@ -0,0 +1,88 @@
1
+ from supabase import create_client
2
+ import time
3
+
4
+
5
+ class ADB:
6
+ def __init__(self, url, key):
7
+ self.url = url
8
+ self.key = key
9
+ self.db = create_client(url, key)
10
+ self.oturum = None # kullanıcı session
11
+
12
+ # ================= AUTH =================
13
+
14
+ def a_kayit_ol(self, email, sifre):
15
+ try:
16
+ return self.db.auth.sign_up({
17
+ "email": email,
18
+ "password": sifre
19
+ })
20
+ except Exception as e:
21
+ print("Kayıt hatası:", e)
22
+ return None
23
+
24
+ def a_giris_yap(self, email, sifre):
25
+ try:
26
+ sonuc = self.db.auth.sign_in_with_password({
27
+ "email": email,
28
+ "password": sifre
29
+ })
30
+
31
+ self.oturum = sonuc.session # session sakla
32
+ return sonuc.user.id # uid döndür
33
+
34
+ except Exception as e:
35
+ print("Giriş hatası:", e)
36
+ return None
37
+
38
+ # Oturum düşerse yenile
39
+ def _kontrol_et(self):
40
+ try:
41
+ if self.oturum:
42
+ self.db.auth.set_session(
43
+ self.oturum.access_token,
44
+ self.oturum.refresh_token
45
+ )
46
+ except:
47
+ pass
48
+
49
+ # ================= TABLO =================
50
+
51
+ def add(self, tablo, uid, **veriler):
52
+ """
53
+ Örnek:
54
+ add("users_data", uid, username="Ali Kaya", skor=34)
55
+ """
56
+ self._kontrol_et()
57
+
58
+ try:
59
+ veriler["user_id"] = uid
60
+ return self.db.table(tablo).insert(veriler).execute()
61
+ except Exception as e:
62
+ print("Veri ekleme hatası:", e)
63
+ return None
64
+
65
+ def get(self, tablo, uid):
66
+ self._kontrol_et()
67
+
68
+ try:
69
+ return self.db.table(tablo) \
70
+ .select("*") \
71
+ .eq("user_id", uid) \
72
+ .single() \
73
+ .execute().data
74
+ except Exception as e:
75
+ print("Veri alma hatası:", e)
76
+ return None
77
+
78
+ def update(self, tablo, uid, **veriler):
79
+ self._kontrol_et()
80
+
81
+ try:
82
+ return self.db.table(tablo) \
83
+ .update(veriler) \
84
+ .eq("user_id", uid) \
85
+ .execute()
86
+ except Exception as e:
87
+ print("Güncelleme hatası:", e)
88
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Qwael
3
- Version: 4.0.4.4
3
+ Version: 4.0.4.6
4
4
  Summary: Qwael: İşlevsel ve kolaylaştırılmış Python kütüphanesi
5
5
  Author: Bedirhan
6
6
  Author-email: bedirhan.oytpass@gmail.com
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
5
5
 
6
6
  setup(
7
7
  name="Qwael",
8
- version="4.0.4.4",
8
+ version="4.0.4.6",
9
9
  packages=find_packages(),
10
10
  install_requires=[
11
11
  "google-api-python-client",
@@ -1,45 +0,0 @@
1
- from supabase import create_client
2
-
3
-
4
- class ADB:
5
-
6
- def __init__(self, url, key):
7
- self.db = create_client(url, key)
8
-
9
- # ========= AUTH =========
10
-
11
- def a_kayit_ol(self, email, sifre):
12
- return self.db.auth.sign_up({
13
- "email": email,
14
- "password": sifre
15
- })
16
-
17
- def a_giris_yap(self, email, sifre):
18
- sonuc = self.db.auth.sign_in_with_password({
19
- "email": email,
20
- "password": sifre
21
- })
22
- return sonuc.user.id # uid döner
23
-
24
- # ========= TABLO =========
25
-
26
- def add(self, tablo, uid, **veriler):
27
- """
28
- Örnek:
29
- add("users_data", uid, username="Ali Kaya", skor=34)
30
- """
31
- veriler["user_id"] = uid
32
- return self.db.table(tablo).insert(veriler).execute()
33
-
34
- def get(self, tablo, uid):
35
- return self.db.table(tablo) \
36
- .select("*") \
37
- .eq("user_id", uid) \
38
- .single() \
39
- .execute().data
40
-
41
- def update(self, tablo, uid, **veriler):
42
- return self.db.table(tablo) \
43
- .update(veriler) \
44
- .eq("user_id", uid) \
45
- .execute()
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
File without changes