본문 바로가기

파이썬3

[python/lib] fake-agent로 웹 header의 agent값 임의로 만들기 # 설치pip install fake-useragent# 사용법은 매우 간단... from fake_useragent import UserAgent ua = UserAgent() ua_arr = [] ua_arr.append(ua.ie) ua_arr.append(ua.msie) ua_arr.append(ua['Internet Explorer']) ua_arr.append(ua.opera) ua_arr.append(ua.chrome) ua_arr.append(ua.google) ua_arr.append(ua['google chrome']) ua_arr.append(ua.firefox) ua_arr.append(ua.ff) ua_arr.append( ua.safari) for item in ua_arr: p.. 2019. 1. 10.
[python/elasitcsearch] 파이썬 elasticsearch(일래스틱서치) 라이브러리 사용하기 # python elasticsearch 설치 - 설치 및 사용 요약 1. pip로 elasticsearch 설치 - 터미널 창에 다음 명령어를 입력후 실행하면, 간단하게 설치 완료됨. [$ pip install elasticsearch ] 또는[$ pip3 install elasticsearch ] 2. import import elasticsearch from elasticsearch import helpers 3. 사용 준비 및 확인 es_client = elasticsearch.Elasticsearch(“localhost:9200”) print (es_client.info()) 4. insert es_client.index(index='test_index', doc_type=folder, body.. 2019. 1. 9.
파이썬(python) 설치부터 파싱(parsing)까지 [python3] 파이썬 설치부터 파싱까지 - OS는 맥(mac)과 우분투(ubuntu) # 파이썬 설치 간단 요약 - 맥(mac) 기준1. Homebrew 설치하기.​- 터미널 창에 다음 명령어를 입력후 실행하면, 간단하게 설치 완료됨. $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”​- 설치후버전 확인$ brew -v​출력 결과 >> Homebrew 0.9.5 ​​- 설치후 homebrew update 하기. $ brew update​​​2. 환경 변수 설정하기​$ cd ~ $ sudo vi .profile​아래 내용 입력 후 저장export PATH=/usr/local/bin:/usr.. 2019. 1. 9.