我如何从async-await返回被拒绝?

时间:2019-04-28 00:43:03

标签: async-await fetch

当获取请求失败时,我想返回被拒绝的页面。如何拒绝异步等待?

def plot_bar_x():
    index = np.arange(len(df['name']))
    plt.figure()
    for name in df.name.unique():
        tmp_df = df[df.name == name]
        plt.bar(tmp_df.index, tmp_df.val, label=name)
    plt.xticks(index, df['name'], fontsize=10, rotation=30)
    plt.legend()
    plt.show()

1 个答案:

答案 0 :(得分:0)

Django SMTPAuthenticationError,您应该使用类似于(这大部分取自jQuery文档)的表示法:

$.getJSON( this.api)
    .done(function( json ) {
    console.log( "JSON Data: " + json.users[ 3 ].name );
  })
  .fail(function( jqxhr, textStatus, error ) {
    var err = textStatus + ", " + error;
    console.log( "Request Failed: " + err );
});
相关问题