Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私の見解でリソースを使用しています。エラーが発生すると、immediatehttpresponse とその httpbadrequest オブジェクトにエラーが返されます。r.response を実行すると、xml 形式のコンテンツが表示されましたが、ステータス コードを取得できませんでした。エラー応答を処理する方法は?
except ImmediateHttpResponse, r: print r.response
HttpBadRequest の場合、ステータス コードは常に 400 です (41 行目の tastypie.http):
class HttpBadRequest(HttpResponse): status_code = 400
また:
r.status_code
あなたにそれを与えるべきです。