반응형
from urllib.parse import urlparse
params = urlparse.parse.quote_plus({'username': 'administrator', 'password': 'xyz'})
나는 얻다
AttributeError : '함수'개체에 'parse'속성이 없습니다.
해결 방법
문서를 잘못 읽었습니다. 다음 두 가지를 수행해야합니다.
운 좋게도 urllib.parse.urlencode
는이 두 가지 작업을 한 번에 수행하며 이것이 사용해야하는 기능입니다.
from urllib.parse import urlencode, quote_plus
payload = {'username':'administrator', 'password':'xyz'}
result = urlencode(payload, quote_via=quote_plus)
# 'password=xyz&username=administrator'
참조 페이지 https://stackoverflow.com/questions/40557606
반응형
'파이썬' 카테고리의 다른 글
파이썬 Python : OverflowError : 수학 범위 오류 (0) | 2020.10.26 |
---|---|
파이썬 Python source code collection (0) | 2020.10.26 |
파이썬 Openpyxl 인덱스로 워크 시트에서 행을 가져 오는 방법 (0) | 2020.10.26 |
파이썬 matplotlib 막대 차트 : 공백 막대 (0) | 2020.10.26 |
파이썬 오류 발생-AttributeError : subprocess.run ([ "ls", "-l"])을 실행하는 동안 'module'개체에 'run'속성이 없습니다. (0) | 2020.10.26 |
댓글