-
User-Agent 지정 ( header )Python 2023. 3. 20. 10:58
header 지정
: 크롤링을 할 때 해당 페이지에서 로봇인지 사람인지 검사하기위해 header (유저) 정보를 요구할 때가 있다.
다음의 경우 User-Agent를 지정해서 이를 해결할 수 있다.
User-Agent 지정
페이지를 가져오기 위해 get 함수를 다음과 같이 사용한다. get( URL , headers = {'User-Agent' : 유저정보} ) 따라서 보통 headers = {' ' : } URL get( USL , headers = headers ) 의 형태로 사용할 수 있다
유저정보 얻는 곳
https://www.useragentstring.com/
UserAgentString.com - unknown version
www.useragentstring.com
- 각 브라우저에 맞춤형으로 지정할 수도 있다.
'Python' 카테고리의 다른 글
데이터 타입(자료형 검사) (0) 2023.03.18 input 자료형 검증 ( try - excpt ) (0) 2023.03.16 nomard) python기초 ( ERROR 모음 ) (0) 2023.03.10 nomard) python기초 (Flask로 웹페이지 만들기) (0) 2023.03.10 nomad) python 기초 (2) (0) 2023.03.06