Add Python dict headers overload to SubscriptionDataSource#9363
Add Python dict headers overload to SubscriptionDataSource#9363aiSynergy37 wants to merge 4 commits intoQuantConnect:masterfrom
Conversation
| /// <param name="headers">The Python dictionary containing the headers to be used for this source</param> | ||
| public SubscriptionDataSource(string source, SubscriptionTransportMedium transportMedium, FileFormat format, PyObject headers) | ||
| : this(source, transportMedium, format, ConvertHeaders(headers)) | ||
| { |
There was a problem hiding this comment.
We have the ConvertToDictionary extension method we can use here:
this(source, transportMedium, format, headers.ConvertToDictionary<string, string>())By the way, we could use this method in QCAlgorithm.Python.cs#L1479 as well.
There was a problem hiding this comment.
Done in d9548eb. I replaced the custom conversion with headers == null ? null : headers.ConvertToDictionary<string, string>() and updated the invalid-input test assertion to match the shared extension exception message.
AlexCatarino
left a comment
There was a problem hiding this comment.
Thank you, @aiSynergy37 ,
We should reuse the ConvertToDictionary extension method.
|
Addressed review feedback in d9548eb: the PyObject headers overload now reuses ConvertToDictionary<string, string>() instead of custom conversion logic, and tests were updated accordingly. |
|
@AlexCatarino Thanks again. The ConvertToDictionary refactor is now in place on the latest commit (d9548eb). Could you please take another look when you have a moment? |
Summary
Testing
Closes #9361