starting scraper development
This commit is contained in:
@ -29,22 +29,7 @@ def create_picture(
|
||||
return result[0]
|
||||
|
||||
|
||||
def delete_picture_by_url(
|
||||
conn: connection,
|
||||
url: str
|
||||
):
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(
|
||||
"""
|
||||
delete from picrinth.pictures
|
||||
where url = %s
|
||||
""",
|
||||
(url,),
|
||||
)
|
||||
conn.commit()
|
||||
return cur.rowcount > 0
|
||||
|
||||
def delete_picture_by_id(
|
||||
def delete_picture(
|
||||
conn: connection,
|
||||
id: int
|
||||
):
|
||||
@ -62,26 +47,9 @@ def delete_picture_by_id(
|
||||
|
||||
# picture receiving
|
||||
|
||||
def get_picture_by_url(
|
||||
def get_picture(
|
||||
conn: connection,
|
||||
url: str
|
||||
):
|
||||
with conn.cursor(cursor_factory=psycopg2.extras.DictCursor) as cur:
|
||||
cur.execute(
|
||||
"""
|
||||
select id, source,
|
||||
external_id, url,
|
||||
metadata, created_at
|
||||
from picrinth.pictures
|
||||
where url = %s
|
||||
""",
|
||||
(url,),
|
||||
)
|
||||
return cur.fetchone()
|
||||
|
||||
def get_picture_by_id(
|
||||
conn: connection,
|
||||
id: str
|
||||
id: int
|
||||
):
|
||||
with conn.cursor(cursor_factory=psycopg2.extras.DictCursor) as cur:
|
||||
cur.execute(
|
||||
|
||||
Reference in New Issue
Block a user