Làm cách nào để tìm mã phản hồi trong python?

2. Tiêu đề HTTP hoặc trường tiêu đề máy chủ chứa thông tin mà khách hàng có thể sử dụng để tìm hiểu thêm về phản hồi và máy chủ đã gửi phản hồi đó. Thông tin này có thể giúp máy khách hiển thị phản hồi cho người dùng, lưu trữ [hoặc bộ đệm] phản hồi để sử dụng trong tương lai và thực hiện các yêu cầu bổ sung cho máy chủ ngay bây giờ hoặc trong tương lai

Content-Type: application/json
Content-Length: 19


3. Phần thân của thông báo HTTP chứa tài nguyên mà máy khách yêu cầu từ máy chủ. Máy chủ không trả về nội dung thư cho HEAD

Thư viện Yêu cầu Python là gì?

Thư viện yêu cầu là Thư viện phổ biến nhất giúp gửi yêu cầu HTTP dễ dàng bằng các phương thức POST, GET và PUT, đăng dữ liệu JSON và XML, tải tệp lên và gửi biểu mẫu HTML. Thư viện tự động xác thực chứng chỉ SSL của máy chủ và hỗ trợ cookie phiên và Tên miền quốc tế. Thư viện yêu cầu được thiết lập trên thư viện urllib3 và ngụy trang sự phức tạp của việc tạo các yêu cầu HTTP đằng sau một API đơn giản. Thư viện yêu cầu không có trong bản phân phối Python, hầu hết mọi người đều sử dụng Thư viện yêu cầu vì mã Python để làm việc với HTTP trở nên đơn giản, ngắn gọn và dễ hiểu

Làm cách nào để sử dụng thư viện Yêu cầu Python?

Để cài đặt thư viện Yêu cầu Python, hãy chạy lệnh sau

Cài đặt thư viện yêu cầu Python

pip install requests


Sau khi cài đặt Thư viện yêu cầu, bạn có thể sử dụng nó trong công việc của mình

import requests


Xem thêm

  • Làm cách nào để tôi nhận JSON bằng Yêu cầu Python?
  • Làm cách nào để sử dụng các đối tượng phiên trong Yêu cầu Python?
  • Làm cách nào để đặt thời gian chờ trong Yêu cầu Python?
  • Làm cách nào để đăng JSON bằng Thư viện yêu cầu Python?
  • Làm cách nào để gửi yêu cầu POST bằng Thư viện yêu cầu Python?
  • Làm cách nào để gửi yêu cầu GET bằng Thư viện yêu cầu Python?

Phản hồi yêu cầu Python Các ví dụ và bài viết về API liên quan

Làm cách nào để chuyển đổi yêu cầu Curl sang Python? . bãi []?

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
2 là gói tập hợp một số mô-đun để làm việc với Giao thức truyền siêu văn bản

  • >>> from http import HTTPMethod
    >>>
    >>> HTTPMethod.GET
    
    >>> HTTPMethod.GET == 'GET'
    True
    >>> HTTPMethod.GET.value
    'GET'
    >>> HTTPMethod.GET.description
    'Retrieve the target.'
    >>> list[HTTPMethod]
    [,
     ,
     ,
     ,
     ,
     ,
     ,
     ,
     ]
    
    3 là ứng dụng khách giao thức HTTP cấp thấp;

  • >>> from http import HTTPMethod
    >>>
    >>> HTTPMethod.GET
    
    >>> HTTPMethod.GET == 'GET'
    True
    >>> HTTPMethod.GET.value
    'GET'
    >>> HTTPMethod.GET.description
    'Retrieve the target.'
    >>> list[HTTPMethod]
    [,
     ,
     ,
     ,
     ,
     ,
     ,
     ,
     ]
    
    5 chứa các lớp máy chủ HTTP cơ bản dựa trên
    >>> from http import HTTPMethod
    >>>
    >>> HTTPMethod.GET
    
    >>> HTTPMethod.GET == 'GET'
    True
    >>> HTTPMethod.GET.value
    'GET'
    >>> HTTPMethod.GET.description
    'Retrieve the target.'
    >>> list[HTTPMethod]
    [,
     ,
     ,
     ,
     ,
     ,
     ,
     ,
     ]
    
    6

  • >>> from http import HTTPMethod
    >>>
    >>> HTTPMethod.GET
    
    >>> HTTPMethod.GET == 'GET'
    True
    >>> HTTPMethod.GET.value
    'GET'
    >>> HTTPMethod.GET.description
    'Retrieve the target.'
    >>> list[HTTPMethod]
    [,
     ,
     ,
     ,
     ,
     ,
     ,
     ,
     ]
    
    7 có các tiện ích để thực hiện quản lý trạng thái với cookie

  • >>> from http import HTTPMethod
    >>>
    >>> HTTPMethod.GET
    
    >>> HTTPMethod.GET == 'GET'
    True
    >>> HTTPMethod.GET.value
    'GET'
    >>> HTTPMethod.GET.description
    'Retrieve the target.'
    >>> list[HTTPMethod]
    [,
     ,
     ,
     ,
     ,
     ,
     ,
     ,
     ]
    
    8 cung cấp tính bền vững của cookie

Mô-đun

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
2 cũng định nghĩa các enum sau đây giúp bạn làm việc với mã liên quan đến http

lớp http. Trạng thái HTTP

Mới trong phiên bản 3. 5

Một lớp con của

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
1 xác định một bộ mã trạng thái HTTP, cụm từ lý do và mô tả dài được viết bằng tiếng Anh

Cách sử dụng

>>> from http import HTTPStatus
>>> HTTPStatus.OK
HTTPStatus.OK
>>> HTTPStatus.OK == 200
True
>>> HTTPStatus.OK.value
200
>>> HTTPStatus.OK.phrase
'OK'
>>> HTTPStatus.OK.description
'Request fulfilled, document follows'
>>> list[HTTPStatus]
[HTTPStatus.CONTINUE, HTTPStatus.SWITCHING_PROTOCOLS, ...]

Mã trạng thái HTTP¶

Các mã trạng thái đã đăng ký IANA được hỗ trợ có sẵn trong

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
2 là

Mã số

Tên liệt kê

Chi tiết

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
3

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
4

HTTP/1. 1 RFC 7231, Phần 6. 2. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
5

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
6

HTTP/1. 1 RFC 7231, Phần 6. 2. 2

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
7

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
8

WebDAV RFC 2518, Phần 10. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
9

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
20

Mã trạng thái HTTP để chỉ gợi ý RFC 8297

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
21

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
22

HTTP/1. 1 RFC 7231, Phần 6. 3. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
23

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
24

HTTP/1. 1 RFC 7231, Phần 6. 3. 2

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
25

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
26

HTTP/1. 1 RFC 7231, Phần 6. 3. 3

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
27

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
28

HTTP/1. 1 RFC 7231, Phần 6. 3. 4

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
29

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
20

HTTP/1. 1 RFC 7231, Phần 6. 3. 5

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
21

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
22

HTTP/1. 1 RFC 7231, Phần 6. 3. 6

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
23

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
24

HTTP/1. 1 RFC 7233, Mục 4. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
25

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
26

WebDAV RFC 4918, Mục 11. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
27

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
28

Phần mở rộng liên kết WebDAV RFC 5842, Phần 7. 1 [Thử nghiệm]

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
29

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
30

Mã hóa Delta trong HTTP RFC 3229, Phần 10. 4. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
31

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
32

HTTP/1. 1 RFC 7231, Phần 6. 4. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
33

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
34

HTTP/1. 1 RFC 7231, Phần 6. 4. 2

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
35

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
36

HTTP/1. 1 RFC 7231, Phần 6. 4. 3

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
37

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
38

HTTP/1. 1 RFC 7231, Phần 6. 4. 4

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
39

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
40

HTTP/1. 1 RFC 7232, Phần 4. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
41

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
42

HTTP/1. 1 RFC 7231, Phần 6. 4. 5

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
43

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
44

HTTP/1. 1 RFC 7231, Phần 6. 4. 7

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
45

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
46

Chuyển hướng vĩnh viễn RFC 7238, Phần 3 [Thử nghiệm]

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
47

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
48

HTTP/1. 1 RFC 7231, Phần 6. 5. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
49

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
50

HTTP/1. 1 Xác thực RFC 7235, Phần 3. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
51

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
52

HTTP/1. 1 RFC 7231, Phần 6. 5. 2

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
53

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
54

HTTP/1. 1 RFC 7231, Phần 6. 5. 3

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
55

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
56

HTTP/1. 1 RFC 7231, Phần 6. 5. 4

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
57

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
58

HTTP/1. 1 RFC 7231, Phần 6. 5. 5

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
59

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
60

HTTP/1. 1 RFC 7231, Phần 6. 5. 6

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
61

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
62

HTTP/1. 1 Xác thực RFC 7235, Phần 3. 2

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
63

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
64

HTTP/1. 1 RFC 7231, Phần 6. 5. 7

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
65

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
66

HTTP/1. 1 RFC 7231, Phần 6. 5. 8

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
67

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
68

HTTP/1. 1 RFC 7231, Phần 6. 5. 9

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
69

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
70

HTTP/1. 1 RFC 7231, Phần 6. 5. 10

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
71

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
72

HTTP/1. 1 RFC 7232, Mục 4. 2

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
73

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
74

HTTP/1. 1 RFC 7231, Phần 6. 5. 11

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
75

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
76

HTTP/1. 1 RFC 7231, Phần 6. 5. 12

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
77

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
78

HTTP/1. 1 RFC 7231, Phần 6. 5. 13

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
79

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
80

HTTP/1. 1 Phạm vi Yêu cầu RFC 7233, Phần 4. 4

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
81

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
82

HTTP/1. 1 RFC 7231, Phần 6. 5. 14

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
83

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
84

HTCPCP/1. 0 RFC 2324, Phần 2. 3. 2

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
85

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
86

HTTP/2 RFC 7540, Mục 9. 1. 2

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
87

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
88

WebDAV RFC 4918, Mục 11. 2

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
89

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
00

WebDAV RFC 4918, Mục 11. 3

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
01

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
02

WebDAV RFC 4918, Mục 11. 4

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
03

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
04

Sử dụng dữ liệu ban đầu trong HTTP RFC 8470

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
05

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
06

HTTP/1. 1 RFC 7231, Phần 6. 5. 15

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
07

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
08

Mã trạng thái HTTP bổ sung RFC 6585

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
09

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
10

Mã trạng thái HTTP bổ sung RFC 6585

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
11

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
12

Mã trạng thái HTTP bổ sung RFC 6585

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
13

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
14

Mã trạng thái HTTP để báo cáo các trở ngại pháp lý RFC 7725

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
15

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
16

HTTP/1. 1 RFC 7231, Phần 6. 6. 1

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
17

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
18

HTTP/1. 1 RFC 7231, Phần 6. 6. 2

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
19

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
20

HTTP/1. 1 RFC 7231, Phần 6. 6. 3

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
21

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
22

HTTP/1. 1 RFC 7231, Phần 6. 6. 4

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
23

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
24

HTTP/1. 1 RFC 7231, Phần 6. 6. 5

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
25

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
26

HTTP/1. 1 RFC 7231, Phần 6. 6. 6

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
27

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
28

Đàm phán nội dung minh bạch trong HTTP RFC 2295, Phần 8. 1 [Thử nghiệm]

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
29

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
30

WebDAV RFC 4918, Mục 11. 5

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
31

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
32

Phần mở rộng liên kết WebDAV RFC 5842, Phần 7. 2. Thực nghiệm]

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
33

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
34

Khung mở rộng HTTP RFC 2774, Phần 7 [Thử nghiệm]

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
35

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
36

Mã trạng thái HTTP bổ sung RFC 6585, Phần 6

Để duy trì khả năng tương thích ngược, các giá trị enum cũng có trong mô-đun

>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
3 ở dạng hằng số. Tên enum bằng với tên hằng [i. e.
>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
38 cũng có sẵn dưới dạng
>>> from http import HTTPMethod
>>>
>>> HTTPMethod.GET

>>> HTTPMethod.GET == 'GET'
True
>>> HTTPMethod.GET.value
'GET'
>>> HTTPMethod.GET.description
'Retrieve the target.'
>>> list[HTTPMethod]
[,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ]
39]

Làm cách nào để kiểm tra phản hồi HTTP trong Python?

Phản hồi. .
yêu cầu nhập khẩu
phản ứng = yêu cầu. nhận ["http. //www. Google. com"]
print["Mã phản hồi. ", phản ứng. status_code]
print["Phản hồi được định dạng dưới dạng văn bản. ",phản ứng. .
print["Phản hồi được định dạng theo byte. ",phản ứng. .
print["Tiêu đề phản hồi. ",phản ứng

Làm cách nào để nhận phản hồi API bằng Python?

Thực hiện lệnh gọi API của bạn .
def get_data[bản thân, api]
phản ứng = yêu cầu. nhận [f"{api}"]
nếu phản hồi. status_code == 200
print["lấy dữ liệu thành công"]
bản thân. formatted_print[phản hồi. json[]]
print[f"Xin chào mọi người, có {response. status_code} lỗi với yêu cầu của bạn"]

Phản hồi 200 có nghĩa là gì trong Python?

200 là mã trạng thái HTTP cho "OK", phản hồi thành công. [Các mã khác mà bạn có thể quen thuộc là 404 Not Found, 403 Forbidden và 500 Internal Server Error. ] Xem RFC 2616 để biết thêm thông tin

Đối tượng phản hồi trong Python là gì?

Định nghĩa và cách sử dụng. các yêu cầu. Đối tượng Response[] chứa phản hồi của máy chủ đối với yêu cầu HTTP .

Chủ Đề