-
Notifications
You must be signed in to change notification settings - Fork 0
migrated python sample #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple small suggestions but nothing major.
Once thing I would do for sure though is remove the other sample files that are not being used (Southwinds, Invetment fact sheet, Sample invoice) so we aren't bloating the project with unused files
print("GUID:", doc.guid) | ||
|
||
#wait for completed status | ||
while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be nice to have more explicit break conditions for the loop since there are some codes other than 302 which are ok and just indicate waiting and others indicate error (which would be good for the customer to be aware of). Breaking on the error conditions will allow us to get the error object as well and not run an infinite loop potentially. Here was the conditions I had for the other ones:
console.log("Generating Document...");
// Post document to the engine for processing
let document = await client.postDocument(template);
//check postDocument status and wait if not ready.
while(true) {
await sleep(1000);
let status = await client.getDocumentStatus(document.Guid);
if (status == 302) {
// The document generation is complete, we can now proceed to retrieve the generated document
break;
}
else if (status == 201 || status == 202 || status == 404) {
// The document generation is still in progress, continue waiting
continue;
}
else {
// Potentially have an error, proceed to retrieve the document to get error details
console.error("Error retrieving document. Status code: ", status);
break;
}
}
I thought about having a retry counter if a 404 is hit a certain amount of times but might be a little much for the sample
|
||
|
||
#get the metrics | ||
metrics = fluent_client.getMetrics(metrics_job.guid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its optional but for metrics and tag tree I also wrote the results out to a file instead of dumping it in the console as it may be tough to read.
@@ -0,0 +1,5 @@ | |||
@echo off | |||
cd /d "%~dp0.." | |||
pip install windwardrestapi==22.2.0.52 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should specify the latest version (Not sure how its done in python whether its a "*" or "LATEST" or what not) but we want to ensure the latest version is always used when they download the sample
No description provided.