123456789101112131415161718192021 |
- def set_cors_rules(self, table_service):
- cors_rule = CorsRule(
- allowed_origins=['*'],
- allowed_methods=['POST', 'GET'],
- allowed_headers=['*'],
- exposed_headers=['*'],
- max_age_in_seconds=3600)
-
- print('1. Get Cors Rules')
- original_cors_rules = table_service.get_table_service_properties().cors
- try:
- print('2. Overwrite Cors Rules')
- table_service.set_table_service_properties(cors=[cors_rule])
- finally:
- #reverting cors rules back to the original ones
- print('3. Revert Cors Rules back the original ones')
- table_service.set_table_service_properties(cors=original_cors_rules)
-
- print("CORS sample completed")
|