1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-11 07:30:37 +01:00

update launch

Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
ふぁ 2023-07-30 19:03:30 +09:00
parent b37c178f1c
commit 0a7f111236
No known key found for this signature in database
GPG key ID: 83A8A5E74872A8AA
2 changed files with 13 additions and 5 deletions

7
.vscode/launch.json vendored
View file

@ -7,7 +7,7 @@
"request": "launch",
"program": "tools/build.py",
"console": "integratedTerminal",
"justMyCode": false
"justMyCode": true
},
{
"name": "Python: Test OpenAPI Serialize",
@ -16,7 +16,10 @@
"program": "test/python/test_serialize.py",
"console": "integratedTerminal",
"justMyCode": false,
"preLaunchTask": "build"
"preLaunchTask": "build",
"env": {
"ERROR_UNCATCHED": "True"
}
}
]
}

View file

@ -9,6 +9,8 @@ from pathlib import Path
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s %(levelname)s %(message)s")
logger = logging.getLogger("test_serialize")
ERROR_UNCATCHED = os.environ.get("ERROR_UNCATCHED", "false").lower() == "true"
if Path("cookie.json").exists():
with open("cookie.json", "r") as f:
cookies = json.load(f)
@ -65,11 +67,14 @@ for x in [pt.DefaultApi, pt.TweetApi, pt.UserApi, pt.UserListApi]:
try:
res = getattr(x(api_client), props)(**kwargs)
except Exception as e:
logger.error(f"{key}")
logger.error(e)
if ERROR_UNCATCHED:
raise e
import traceback
logger.error(traceback.print_exc())
logger.error("==========[STACK TRACE]==========")
for trace in traceback.format_exc().split("\n"):
logger.error(trace)
logger.info("================================")
error_count += 1
if error_count > 0: