зеркало из
https://github.com/viginum-datalab/twscrape.git
synced 2025-10-29 05:04:22 +02:00
ability to get single account by name
Этот коммит содержится в:
родитель
ae2b15dde5
Коммит
490ffe2620
@ -121,6 +121,13 @@ class AccountsPool:
|
|||||||
rs = await fetchall(self._db_file, qs)
|
rs = await fetchall(self._db_file, qs)
|
||||||
return [Account.from_rs(x) for x in rs]
|
return [Account.from_rs(x) for x in rs]
|
||||||
|
|
||||||
|
async def get_account(self, username: str):
|
||||||
|
qs = "SELECT * FROM accounts WHERE username = :username"
|
||||||
|
rs = await fetchone(self._db_file, qs, {"username": username})
|
||||||
|
if not rs:
|
||||||
|
return None
|
||||||
|
return Account.from_rs(rs)
|
||||||
|
|
||||||
async def save(self, account: Account):
|
async def save(self, account: Account):
|
||||||
data = account.to_rs()
|
data = account.to_rs()
|
||||||
cols = list(data.keys())
|
cols = list(data.keys())
|
||||||
|
|||||||
Загрузка…
x
Ссылка в новой задаче
Block a user