Qwael 4.0.4.6__tar.gz → 4.0.4.8__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.6
3
+ Version: 4.0.4.8
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,154 @@
1
+ from supabase import create_client
2
+ from threading import Thread
3
+
4
+
5
+ class ADB:
6
+
7
+ def __init__(self, url, key):
8
+ self.db = create_client(url, key)
9
+ self.current_uid = None
10
+
11
+ # ================= THREAD SİSTEM =================
12
+
13
+ def _async(self, func, callback=None, verify=None):
14
+ def run():
15
+ try:
16
+ sonuc = func()
17
+ if verify is not None:
18
+ verify.clear()
19
+ verify.append(True)
20
+ if callback:
21
+ callback(sonuc)
22
+ except Exception as e:
23
+ if verify is not None:
24
+ verify.clear()
25
+ verify.append(False)
26
+ print("ADB HATA:", e)
27
+
28
+ Thread(target=run, daemon=True).start()
29
+
30
+ # ================= AUTH =================
31
+
32
+ def a_kayit_ol(self, email, sifre, callback=None, verify=None):
33
+ self._async(
34
+ lambda: self.db.auth.sign_up({
35
+ "email": email,
36
+ "password": sifre
37
+ }),
38
+ callback,
39
+ verify
40
+ )
41
+
42
+ def a_giris_yap(self, email, sifre, callback=None, verify=None):
43
+
44
+ def islem():
45
+ res = self.db.auth.sign_in_with_password({
46
+ "email": email,
47
+ "password": sifre
48
+ })
49
+ self.current_uid = res.user.id
50
+ return self.current_uid
51
+
52
+ self._async(islem, callback, verify)
53
+
54
+ def cikis_yap(self, verify=None):
55
+
56
+ def islem():
57
+ self.db.auth.sign_out()
58
+ self.current_uid = None
59
+
60
+ self._async(islem, verify=verify)
61
+
62
+ # ================= VERİ TABANI =================
63
+
64
+ def add(self, tablo, uid=None, callback=None, verify=None, **veriler):
65
+
66
+ def islem():
67
+ uid_kullan = uid if uid is not None else self.current_uid
68
+ if uid_kullan is None:
69
+ raise Exception("UID yok, önce giriş yap")
70
+
71
+ veriler["user_id"] = uid_kullan
72
+ return self.db.table(tablo).insert(veriler).execute()
73
+
74
+ self._async(islem, callback, verify)
75
+
76
+ def get(self, tablo, uid=None, callback=None, verify=None):
77
+
78
+ def islem():
79
+ uid_kullan = uid if uid is not None else self.current_uid
80
+ if uid_kullan is None:
81
+ raise Exception("UID yok")
82
+
83
+ return self.db.table(tablo)\
84
+ .select("*")\
85
+ .eq("user_id", uid_kullan)\
86
+ .execute().data
87
+
88
+ self._async(islem, callback, verify)
89
+
90
+ def update(self, tablo, uid=None, callback=None, verify=None, **veriler):
91
+
92
+ def islem():
93
+ uid_kullan = uid if uid is not None else self.current_uid
94
+ if uid_kullan is None:
95
+ raise Exception("UID yok")
96
+
97
+ return self.db.table(tablo)\
98
+ .update(veriler)\
99
+ .eq("user_id", uid_kullan)\
100
+ .execute()
101
+
102
+ self._async(islem, callback, verify)
103
+
104
+ def delete(self, tablo, uid=None, callback=None, verify=None):
105
+
106
+ def islem():
107
+ uid_kullan = uid if uid is not None else self.current_uid
108
+ if uid_kullan is None:
109
+ raise Exception("UID yok")
110
+
111
+ return self.db.table(tablo)\
112
+ .delete()\
113
+ .eq("user_id", uid_kullan)\
114
+ .execute()
115
+
116
+ self._async(islem, callback, verify)
117
+
118
+
119
+ # ================= KULLANIMI DAHA BASİT OLSUN DİYE =================
120
+
121
+ _db = None
122
+
123
+
124
+ def baslat(url, key):
125
+ global _db
126
+ _db = ADB(url, key)
127
+
128
+
129
+ def a_kayit_ol(email, sifre, callback=None, verify=None):
130
+ _db.a_kayit_ol(email, sifre, callback, verify)
131
+
132
+
133
+ def a_giris_yap(email, sifre, callback=None, verify=None):
134
+ _db.a_giris_yap(email, sifre, callback, verify)
135
+
136
+
137
+ def cikis_yap(verify=None):
138
+ _db.cikis_yap(verify)
139
+
140
+
141
+ def add(tablo, uid=None, callback=None, verify=None, **veriler):
142
+ _db.add(tablo, uid, callback, verify, **veriler)
143
+
144
+
145
+ def get(tablo, uid=None, callback=None, verify=None):
146
+ _db.get(tablo, uid, callback, verify)
147
+
148
+
149
+ def update(tablo, uid=None, callback=None, verify=None, **veriler):
150
+ _db.update(tablo, uid, callback, verify, **veriler)
151
+
152
+
153
+ def delete(tablo, uid=None, callback=None, verify=None):
154
+ _db.delete(tablo, uid, callback, verify)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Qwael
3
- Version: 4.0.4.6
3
+ Version: 4.0.4.8
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.6",
8
+ version="4.0.4.8",
9
9
  packages=find_packages(),
10
10
  install_requires=[
11
11
  "google-api-python-client",
@@ -1,88 +0,0 @@
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
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