fixed sqlite copy permission error
This commit is contained in:
@@ -227,6 +227,25 @@ def build_headers(auth_headers):
|
||||
|
||||
def build_session():
|
||||
retailer_session = load_costco_session()
|
||||
click.echo(
|
||||
"session bootstrap: "
|
||||
f"cookies={bool(retailer_session.cookies)}, "
|
||||
f"authorization={'costco-x-authorization' in retailer_session.headers}, "
|
||||
f"client_id={'costco-x-wcs-clientId' in retailer_session.headers}, "
|
||||
f"client_identifier={'client-identifier' in retailer_session.headers}"
|
||||
)
|
||||
|
||||
auth = retailer_session.headers.get("costco-x-authorization", "")
|
||||
if auth:
|
||||
click.echo(
|
||||
f"auth prefix ok={auth.startswith('Bearer ')} len={len(auth)} token_prefix={auth[:24]}"
|
||||
)
|
||||
|
||||
click.echo(
|
||||
"header values: "
|
||||
f"client_id={retailer_session.headers.get('costco-x-wcs-clientId', '')} "
|
||||
f"client_identifier={retailer_session.headers.get('client-identifier', '')}"
|
||||
)
|
||||
session = requests.Session()
|
||||
session.cookies.update(retailer_session.cookies)
|
||||
session.headers.update(build_headers(retailer_session.headers))
|
||||
@@ -247,7 +266,7 @@ def graphql_post(session, query, variables):
|
||||
last_response = response
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
click.echo(f"retry {attempt + 1}/3 status={response.status_code}")
|
||||
click.echo(f"retry {attempt + 1}/3 status={response.status_code} body={response.text[:500]}")
|
||||
except Exception as exc: # pragma: no cover - network error path
|
||||
click.echo(f"retry {attempt + 1}/3 error={exc}")
|
||||
time.sleep(3)
|
||||
|
||||
Reference in New Issue
Block a user