■ get 함수의 data 인자를 사용해 폼 URL 인코딩 방식으로 데이터를 전달하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import httpx def printResponse(title, response): print(title ) print(f" response : {response}" ) print(f" response.url : {response.url}" ) print(f" response.headers['content-type'] : {response.headers['content-type']}") print(f" response.encoding : {response.encoding}" ) print(f" response.status_code : {response.status_code}" ) #print(f" response.text : {response.text}" ) print() dataDictionary = {"key1" : "value1", "key2" : "value2"} response = httpx.post("https://httpbin.org/post", data = dataDictionary) printResponse("FORM URL 인코딩 데이터 전달", response) """ FORM URL 인코딩 데이터 전달 response : <Response [200 OK]> response.url : https://httpbin.org/post response.headers['content-type'] : application/json response.encoding : ascii response.status_code : 200 """ |