def test_get_host_base_from_uri(self): blob_uri = "http://qingfu2.blob.core.windows.net/vhds/abc.sh?st=2014-06-27Z&se=2014-06-27&sr=c&sp=r&sig=KBwcWOx" host_base = cs.get_host_base_from_uri(blob_uri) self.assertEqual(host_base, ".blob.core.windows.net") blob_uri = "https://yue.blob.core.chinacloudapi.cn/" host_base = cs.get_host_base_from_uri(blob_uri) self.assertEqual(host_base, ".blob.core.chinacloudapi.cn")
def create_blob(blob, txt): uri = blob.uri host_base = cs.get_host_base_from_uri(uri) service = BlobService(blob.name, blob.key, host_base=host_base) container_name = cs.get_container_name_from_uri(uri) blob_name = cs.get_blob_name_from_uri(uri) service.put_block_blob_from_text(container_name, blob_name, txt)