본문 바로가기
반응형

python10

Selenium 에서 class, id 특정 element의 click 이 안될때 driver.find_elements('class',"btn_box_ss btn_tank radius_10").click() 셀레니움에서 find_element를 한뒤에 클릭이 안될때 저 class에 해당하는 요소를 클릭하려고 했는데 도저히 안됬었다. DeprecationWarning: executable_path has been deprecated, please pass in a Service object driver = webdriver.Chrome('/Users/kitty/chromedriver') selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid locator (Session info: ch.. 2022. 8. 31.
[google drive api] python으로 구글 드라이브에 xlsx 파일 업로드 from googleapiclient.discovery import build from httplib2 import Http from oauth2client import file, client, tools from googleapiclient.http import MediaFileUpload try : import argparse flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args() except ImportError: flags = None SCOPES = 'https://www.googleapis.com/auth/drive.file' store = file.Storage('storage.json') creds = store.ge.. 2021. 3. 12.
네이버 이미지 웹크롤링 import urllib.request from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.common.keys import Keys import time binary = 'chromedriver.exe' options = webdriver.ChromeOptions() options.add_experimental_option('excludeSwitches', ['enable-logging']) browser = webdriver.Chrome(options=options) browser.implicitly_wait(10) browser.get("https://search.naver.com/search.nav.. 2020. 12. 17.
Bluetooth: bluetooth_adapter_winrt.cc:1074 Getting Default Adapter failed. 에러 [15896:26680:1217/153844.486:ERROR:device_event_log_impl.cc(211)] [15:38:44.485] Bluetooth: bluetooth_adapter_winrt.cc:1073 Getting Default Adapter failed. 크롬 드라이버를 사용하던 중 이런 에러가 떴었다. 이럴땐 크롬 옵션에다가 아래의 문구를 삽입해 주면 해결이 된다. options = webdriver.ChromeOptions() options.add_experimental_option('excludeSwitches', ['enable-logging']) driver = webdriver.Chrome(options=options) 2020. 12. 17.
[웹크롤링] 랜덤 uger-agent, 랜덤 Proxy IP 우회 class from http_request_randomizer.requests.proxy.requestProxy import RequestProxy from fake_headers import Headers import requests class RANDOM_PROXY: def __init__(self): self.proxy = self.proxy_crate() self.crawling() def proxy_create(self): """ 무작위로 프록시를 생성해서 가져오는 코드 """ self.req_proxy = RequestProxy() proxy = self.test_proxy() # 잘 작동되는 프록시 선별 return proxy def test_proxy(self): """ 가져온 프록시중에서 실제로 작.. 2020. 11. 12.
[웹크롤링] beautifulsoup 없이 하드코딩으로 60배 빠르게 웹크롤링하기 2020/11/11 - [python/python 성능개선] - [python] 라인마다 걸리는 시간을 체크해주는 line_profiler [python] 라인마다 걸리는 시간을 체크해주는 line_profiler 라인 프로파일러를 설치하는 방법은 간단하다. pip install line_profiler 하지만 나는 위 방법으로 자꾸 안깔려서 Anaconda navigator 에서 직접 파일을 검색해서 깔았더니 됬다. (windows) 실행하는 방법은 실 sulung-sulung.tistory.com 이전글에서 beautifulsoup 의 html.parser 가 너무 많은 시간을 잡아 먹는다는것을 알았다. 어떻게 이방식을 알았을까? html 같은 경우 bytes 파일로 떨어지는데 이걸 먼저 슬라이싱해서.. 2020. 11. 11.
반응형