Reputation: 7581
I am trying to enable CORS for a specific azure account/table from the python sdk.
Unfortunately the docs do not cover that topic. From looking here I know that I must use the set_table_service_properties()
and pass the storage_service_properties
argument. But I don't know how is this argument supposed to be formatted.
Should I create a dictionary that when passed to the xml converted will produce something like that?
<?xml version="1.0" encoding="utf-8"?>
<StorageServiceProperties>
<Logging>
<Version>1.0</Version>
<Delete>true</Delete>
<Read>false</Read>
<Write>true</Write>
<RetentionPolicy>
<Enabled>true</Enabled>
<Days>7</Days>
</RetentionPolicy>
</Logging>
<HourMetrics>
<Version>1.0</Version>
<Enabled>true</Enabled>
<IncludeAPIs>false</IncludeAPIs>
<RetentionPolicy>
<Enabled>true</Enabled>
<Days>7</Days>
</RetentionPolicy>
</HourMetrics>
<MinuteMetrics>
<Version>1.0</Version>
<Enabled>true</Enabled>
<IncludeAPIs>true</IncludeAPIs>
<RetentionPolicy>
<Enabled>true</Enabled>
<Days>7</Days>
</RetentionPolicy>
</MinuteMetrics>
<Cors>
<CorsRule>
<AllowedOrigins> http://www.fabrikam.com,http://www.contoso.com</AllowedOrigins>
<AllowedMethods>GET,PUT</AllowedMethods>
<MaxAgeInSeconds>500</MaxAgeInSeconds>
<ExposedHeaders>x-ms-meta-data*,x-ms-meta-customheader</ExposedHeaders>
<AllowedHeaders>x-ms-meta-target*,x-ms-meta-customheader</AllowedHeaders>
</CorsRule>
</Cors>
</StorageServiceProperties>
Upvotes: 1
Views: 98
Reputation: 2457
This is shortly going to be fixed in the next version of the Python library (to be released very soon, see the dev branch), but at the moment the library doesn't support setting CORS.
In the new version, it will be settable something like this sample shows.
Upvotes: 5