feat(schema): add method & code columns
This commit is contained in:
parent
524f9fd3c9
commit
74e6771fd3
1 changed files with 8 additions and 2 deletions
10
addon.py
10
addon.py
|
@ -16,7 +16,9 @@ with db as conn:
|
|||
conn.executescript('''
|
||||
create table if not exists data (
|
||||
id integer primary key,
|
||||
url text not null
|
||||
method text not null default "GET",
|
||||
url text not null,
|
||||
code integer default null
|
||||
);
|
||||
''')
|
||||
|
||||
|
@ -30,7 +32,11 @@ def response(flow: HTTPFlow) -> None:
|
|||
return
|
||||
uid: int = 0
|
||||
with db as conn:
|
||||
cur = conn.execute('insert into data (url) values (?) returning id', (url,))
|
||||
code = flow.response.status_code
|
||||
cur = conn.execute(
|
||||
'insert into data (method, url, code) values (?, ?, ?) returning id',
|
||||
(req.method, url, code if code != 200 else None),
|
||||
)
|
||||
uid = cur.fetchone()[0]
|
||||
path = os.path.join(storage, f'{uid}')
|
||||
if not os.path.exists(path):
|
||||
|
|
Loading…
Add table
Reference in a new issue