小编ewo*_*okx的帖子

Azure Python 下载存储 blob 返回“未满足使用 HTTP 条件标头指定的条件。”

使用以下代码:


import os
from azure.identity import (
    ClientSecretCredential
)

# Import the client object from the Azure library
from azure.storage.blob import BlobClient

t_id = "<tenant_id>"
c_id = "<client_id>"
s_acct = "<storage_account_name>"
s_acct_url = "%s.blob.core.windows.net" % s_acct
sek = "<client_sekret>"

print("+ Setup credentials.")
credential = ClientSecretCredential(t_id, c_id, sek)
print("+ Setup Blob Client")
bobc = BlobClient(s_acct_url, <container_name>, <blob_name>,
                  credential=credential)
print("+ Setup streamer")
ssd = bobc.download_blob()
print("+ Get properties")
print(ssd.get_blob_properties())
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

$ python azdown.py
+ Setting up stream
+
+ Download stream:
+ …
Run Code Online (Sandbox Code Playgroud)

python azure azure-blob-storage

5
推荐指数
1
解决办法
1071
查看次数

程序运行 Pika 抛出 AMQPConnectionError

通过此处找到的 Rabbit MQ Pika HelloWorld 教程:https : //www.rabbitmq.com/tutorials/tutorial-one-python.html

问题是,每当我运行接收脚本时,我都会收到此错误:

Traceback (most recent call last):
  File "receive.py", line 5, in <module>
    pika.ConnectionParameters(host='localhost'))

  File "C:\Users\Colin Warn\PycharmProjects\untitled2\venv\lib\site-packages\pika\adapters\blocking_connection.py", line 360, in __init__
    self._impl = self._create_connection(parameters, _impl_class)

  File "C:\Users\Colin Warn\PycharmProjects\untitled2\venv\lib\site-packages\pika\adapters\blocking_connection.py", line 451, in _create_connection
 
raise self._reap_last_connection_workflow_error(error)

pika.exceptions.AMQPConnectionError
Run Code Online (Sandbox Code Playgroud)

这是我试图运行的代码:

#!/usr/bin/env python
import pika

connection = pika.BlockingConnection(
    pika.ConnectionParameters(host='localhost'))
channel = connection.channel()

channel.queue_declare(queue='hello')


def callback(ch, method, properties, body):
    print(" [x] Received %r" % body)


channel.basic_consume(
    queue='hello', on_message_callback=callback, auto_ack=True)

print(' [*] Waiting for messages. To exit press CTRL+C') …
Run Code Online (Sandbox Code Playgroud)

python rabbitmq pika

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

python ×2

azure ×1

azure-blob-storage ×1

pika ×1

rabbitmq ×1