def _insert_entity_to_package_version_table(package, version, python2, python3, downloads, upload_time): # TODO: issue with python azure storage. Version can't have '~' in it. https://github.com/Azure/azure-storage-python/issues/76 package_sanitized = urllib.parse.quote_plus(package) version_sanitized = urllib.parse.quote_plus(version) try: result = table_service.insert_or_replace_entity(config.PACKAGE_VERSION_DATA_TABLENAME, package_sanitized, version_sanitized, {'PartitionKey' : package_sanitized, 'RowKey': version_sanitized, 'Python2': python2, 'Python3': python3, 'Downloads': downloads, 'UploadTime': upload_time}) return result except Exception as e: logger.error("Failed to insert Package:{} Version:{} Python2:{} Python3:{} Downloads:{} UploadTime:{} Exception:{}".format( package, version, python2, python3, downloads, upload_time, traceback.format_exc())) raise e