I have a question regarding my Object store, I uploaded a file using v2 object/set api, I see a 200, but file is not available. Error is invalid argument. Does this work at all?
Not sure what is wrong.
QUANTCONNECT COMMUNITY
I have a question regarding my Object store, I uploaded a file using v2 object/set api, I see a 200, but file is not available. Error is invalid argument. Does this work at all?
Not sure what is wrong.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Mia Alissi
To help Manoj with the issue of uploading a file using the Object Store API and receiving an "invalid argument" error, let's go through the following troubleshooting steps:
Verify API Usage: Ensure that the
set_object_store
method is being used correctly. The method requires three parameters:organization_id
: The ID of the organization to which the file is being uploaded.key
: A unique key for the Object Store file.object_data
: The file data as a list of bytes.Here's a sample usage:
Check Permissions: Make sure that the account being used has the necessary permissions to create storage in the Object Store. Without these permissions, the upload might not succeed even if a 200 status is returned.
Validate File Format: Ensure that the file being uploaded is correctly converted to a list of bytes. If the file is not in the correct format, it could lead to an "invalid argument" error.
Inspect Error Message: Although you received a 200 status, the "invalid argument" error suggests that there might be an issue with one of the parameters. Double-check the values being passed, especially the
key
andobject_data
.Review Key-Value Pair: Ensure that the
key
is unique within your organization and correctly formatted. Avoid using special characters that might not be supported.Test with Sample Data: Try uploading a simple text file or a small byte array to see if the issue persists. This can help determine if the problem is with the specific file or the API usage.
Consult Documentation: Refer to the QuantConnect documentation for any additional troubleshooting steps or common issues related to the Object Store API.
By following these steps, Manoj should be able to identify and resolve the issue with uploading files to the Object Store. If the problem persists, it might be helpful to contact QuantConnect support for further assistance.
Sources: Object Store - QuantConnect.com, Object Store - QuantConnect.com, Object Store - QuantConnect.com
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Manoj Kandlikar
It doesn't work I tried :
with open(file_path, 'rb') as f:
files = {
'objectData': f # the key should be 'objectData' as per the API requirement
}
response = requests.post(
"https://www.quantconnect.com/api/v2/object/set", # API endpoint
# auth=(str(user), authHexDigest),
auth = (user, authHexDigest),
headers = head,
files=files # sending the file in 'files' parameter
)
print(f"response : {response.text}")
Louis Szeto
Hi Manoj
Can you check in the organization object store page (https://www.quantconnect.com/organization/<your-organization-id>/object-store) if the file is there? If so, you may need to shut down and restart the notebook/project to let them reload the object store.
Best
Louis
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Manoj Kandlikar
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!