table-service_3.py 1.1 KB

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