/* center content */
#content-container {
width: 50%;
height: 50%;
border: 3px solid red;
/* positioning */
margin-top: 50vh;
margin-left: 50vw;
transform: translate(-50%, -50%);
max-height: 100%;
}
/* wrapp content */
#wrapper {
width: 100%;
height: 100%;
max-height: 100%;
margin: 0;
/*Centering content*/
display: inline-flex;
justify-content: center;
align-items: content;
}
#img-desc-container {
display: flex;
flex-direction: column;
}
/* MULTI ELEMENT */
.image-area,
.description-area {
width: 200px;
height: 125px;
border: 1px solid black;
}
.image-area,
.description-area,
#list-area {
box-sizing: border-box;
margin: 10px;
}
/* LIST AREA */
#list-area {
width: 200px;
height: 250px;
border: 1px solid black;
background-color: #22AED1;
float: left;
}
/* IMG AREA */
.image-area {
background-color: #016FB9;
}
.image-area img {
width: 100%;
height: 100%;
}
/* DESC AREA */
.description-area {
background-color: #AFA98D;
height: 105px;
}
/*FLEX CONTAINER */
#flex-container {
padding: 0;
margin: 0;
list-style: none;
display: flex;
-webkit-flex-flow: row wrap;
justify-content: space-around;
}
@pytest.fixture
def settings():
with open('../config.yaml') as yaml_stream:
return yaml.load(stream=yaml_stream)
@pytest.fixture
def viewers(settings):
try:
data = requests.get(settings['endpoints']['viewers']).json()
return data[0]['viewers']
except Exception:
print('ERROR retrieving viewers')
raise(SystemExit)
@pytest.fixture
def viewers_buffer_health(viewers):
print(viewers)
viewers_with_buffer_health = {}
for viewer in viewers:
try:
data = requests.get(settings['endpoints']['node_buffer_health']).replace('<NODE_ID>', viewer)
except Exception as e:
print('ERROR retrieving buffer_health for {}'.format(viewer))
raise(SystemExit)
viewers_with_buffer_health[viewer] = data[0]['avg_buffer_health']
return viewers_with_buffer_health
上的viewers_buffer_health
灯具requests
始终失败,因为'function' object is not subscriptable
其他时候我看到过这样的错误,因为我用相同的名称调用了一个变量和一个函数,但情况并非如此(或者我根本就是盲目的)。
虽然这不重要,但viewers
的输出是['a4a6b1c0-e98a-42c8-abe9-f4289360c220', '152bff1c-e82e-49e1-92b6-f652c58d3145', '55a06a01-9956-4d7c-bfd0-5a2e6a27b62b']
答案 0 :(得分:1)
由于viewers_buffer_health()
没有settings
的本地定义,因此它使用之前定义的函数。如果它的工作方式与viewers()
相同,那么您需要在其当前参数集中添加settings
参数。
答案 1 :(得分:0)
settings
是一个功能。
data = requests.get(settings()['endpoints']['node_buffer_health']).replace('<NODE_ID>', viewer)