我通常尝试使用paytm.com的api通过请求模块在python中进行编码,我正确地传递了每个postdata和标头,并且它具有一个标头身份验证:基本的“ base64encoded字符串”
最初,我直接在标头中传递了它没有用,然后通过<form class="variations_form" method="post" enctype='multipart/form-data' data-product_id="<?php echo absint( $product->get_id() ); ?>" data-product_variations="<?php echo htmlspecialchars( json_encode( $available_variations ) ) ?>">
<div class="variations">
<?php
foreach ( $attributes as $attribute_name => $options ) : ?>
<tr>
<td class="label"><label for="<?php echo sanitize_title( $attribute_name ); ?>"><?php echo wc_attribute_label( $attribute_name ); ?></label></td>
<td class="value">
<?php
$selected = isset( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ? wc_clean( urldecode( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ) : $product->get_variation_default_attribute( $attribute_name );
wc_dropdown_variation_attribute_options( array( 'options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected ) );
echo end( $attribute_keys ) === $attribute_name ? apply_filters( 'woocommerce_reset_variations_link', '<a class="reset_variations" href="#">' . __( 'Clear', 'woocommerce' ) . '</a>' ) : '';
?>
</td>
</tr>
<?php endforeach;
?>
</div>
</form>
传递了它,并在运行它并获得r=requests.post(url,headers=headers,data=pdata,auth=HTTPBasicAuth('market-app:','9a071762-a499-4bd9-914a-xxxxxxxx'))
之后,它甚至给出了auth shd传递给它的方式,但仍然没有通过没有给出错误给出的响应r.request.headers['Headers']
,即使我尝试了This request requires HTTP authentication.
,我在哪里也想不到。