[ํŒŒ์ด์ฌ] ํ…์ŠคํŠธ ํŒŒ์ผ ์ธ์ฝ”๋”ฉ ๋ณ€ํ™˜ ํ•จ์ˆ˜
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
ํŒŒ์ผ์˜ ์ธ์ฝ”๋”ฉ์„ utf-8๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜์ด๋‹ค. chardet ํŒจ์น˜ํ‚ค ์„ค์น˜๊ฐ€ ํ•„์š”ํ•˜๋‹ค import chardet # ํŒจํ‚ค์ง€ ์„ค์น˜ ํ•„์š” # file_path -> Encoding Type def is_encoded(file_path: str): rawdata = open(file_path, mode='rb').read() data = chardet.detect(rawdata) result = data['encoding'] return result # File_path, Encoding_Type -> Change Files encoding type def to_utf8(file_path: str, encoding_in: str): try: with open(file_path, 'r', encoding=enc..
[ํŒŒ์ด์ฌ] ๊ตฌ๊ธ€ ํฌ๋กค๋ง ์‹œ UserAgent ๋ฐ Coockie ์„ค์ • ํ•˜์ž
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
ํฌ๋กค๋ง ์‹œ User-Agent ๋ฐ Cookie๋ฅผ ์„ค์ •ํ•œ๋‹ค. ๋ง‰ํžˆ๊ฒŒ ๋˜๋ฉด Cookie ๊ฐ’์„ ๊ฐฑ์‹ ํ•ด์ฃผ์ž headers = {'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36", 'Cookie': 'GSP=A=7_cV4w:CPTS=1654785473:LM=1654785473:S=n9a7P7syvEx3nONo; NID=511=MyGhFfwN2Y_7VS3Uf5iH34nuwysQS2BKgP5rIg3unnXniEC0D96W480QTrgX5u0ZpK85OrRfTt4-qvX_gcM11bpdbxPN0ApykvA3t_PBg14yAx0QrRhv..
[ํŒŒ์ด์ฌ] ๊ฐ€์ด๋“œ๋ถ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
Python Functions: Advanced Concepts • Python Land Tutorial Python Functions: Advanced Concepts Do you know all about Python functions? These advanced functions concepts will surely teach you something new and help you improve your code. python.land https://wikidocs.net/109303 029 ์ˆœ์„œ๋Œ€๋กœ ์ขŒํ‘œ๋ฅผ ์ •๋ ฌํ•˜๋ ค๋ฉด? โ€• functools.cmp_to_key functools.cmp_to_key(func)๋Š” sorted()์™€ ๊ฐ™์€ ์ •๋ ฌ ํ•จ์ˆ˜์˜ key ๋งค๊ฐœ๋ณ€์ˆ˜์— ํ•จ์ˆ˜(func)๋ฅผ ์ „๋‹ฌํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š”..
[ํŒŒ์ด์ฌ] pyinstaller๋กœ ์œˆ๋„์šฐ ๋ฆฌ๋ˆ…์Šค ์‹คํ–‰ํŒŒ์ผ ๋งŒ๋“ค๊ธฐ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
https://youtu.be/RMkPGjGhzxg
[ํŒŒ์ด์ฌ] ๋ฐ์ดํ„ฐ ์กฐํšŒ ์†๋„ ๊ฐœ์„ 
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
https://victorydntmd.tistory.com/313 [Elasticsearch] ์ž…๋ฌธํ•˜๊ธฐ(3) - ๋‹ค์–‘ํ•œ ๊ฒ€์ƒ‰ ๋ฐฉ๋ฒ• ( Search API ) ES๋Š” ๊ฒ€์ƒ‰ ์—”์ง„์ธ ๋งŒํผ ๋‹ค์–‘ํ•œ ๊ฒ€์ƒ‰ API๋ฅผ ์ œ๊ณตํ•˜๋ฉฐ, ์ด๋ฅผ ์ž˜ ์•Œ์•„์•ผ ES๋ฅผ ํšจ๊ณผ์ ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ์ด๋ผ ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฒˆ ๊ธ€์—์„œ๋Š” Search API์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ๊ธ€ Query DSL์„ ๋‹ค๋ฃจ๊ธฐ victorydntmd.tistory.com http://labs.brandi.co.kr/2021/07/08/leekh.html AWS Elasticsearch + Python์„ ํ™œ์šฉํ•œ '๊ฒ€์ƒ‰' ๋„์ „๊ธฐ Overview labs.brandi.co.kr https://db-engines.com/en/ranking/search+engine..
[ํŒŒ์ด์ฌ] ํฌ๋กค๋ง ์†๋„ ๊ฐœ์„  ๋ฐฉ๋ฒ•
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
ํŒŒ์ด์ฌ ํฌ๋กค๋ง์„ ๋” ๋น ๋ฅด๊ฒŒ ์ˆ˜ํ–‰ํ•˜๋Š” ๋ช‡ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์„ ์ œ์•ˆํ•ด ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค. ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ(Asynchronous Processing) ์‚ฌ์šฉ: ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ๋Š” ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๋™์•ˆ ๋‹ค๋ฅธ ์ฝ”๋“œ ์‹คํ–‰์„ ์ค‘๋‹จํ•˜์ง€ ์•Š๊ณ ๋„ ๋ณ‘๋ ฌ๋กœ ์ž‘์—…์„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ๊ธฐ์ˆ ์ž…๋‹ˆ๋‹ค. ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋” ๋น ๋ฅด๊ฒŒ ์›น ์‚ฌ์ดํŠธ์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, asyncio์™€ aiohttp ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋น„๋™๊ธฐ HTTP ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋”ฉ ๋˜๋Š” ๋ฉ€ํ‹ฐํ”„๋กœ์„ธ์‹ฑ ์‚ฌ์šฉ: ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋”ฉ ๋˜๋Š” ๋ฉ€ํ‹ฐํ”„๋กœ์„ธ์‹ฑ์„ ์‚ฌ์šฉํ•˜์—ฌ CPU ๋ฐ I/O ๋ฐ”์šด๋“œ ์ž‘์—…์„ ๋ณ‘๋ ฌ๋กœ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. CPU ๋ฐ”์šด๋“œ ์ž‘์—…์€ ๊ณ„์‚ฐ ์ง‘์•ฝ์  ์ž‘์—…์œผ๋กœ์„œ, ๋ฉ€ํ‹ฐํ”„๋กœ์„ธ์‹ฑ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. I/O ๋ฐ”์šด๋“œ ์ž‘์—…์€ ๋„คํŠธ์›Œํฌ ๋˜๋Š” ๋””์Šคํฌ I..
[ํŒŒ์ด์ฌ] ํ”„๋กœ์„ธ์Šค ํ•ธ๋“ค๋ง
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
ํŒŒ์ด์ฌ์œผ๋กœ Process List, PID ์™€ Process Kill (tistory.com) ํŒŒ์ด์ฌ์œผ๋กœ Process List, PID ์™€ Process Kill ํŠน์ • ์•…์„ฑ์ฝ”๋“œ๋Š” ์ž์‹ ์˜ ์•…์„ฑํ–‰์œ„๋ฅผ ํ•˜๊ธฐ ์œ„ํ•ด ํ˜„์žฌ ์‹œ์Šคํ…œ์˜ ํ”„๋กœ์„ธ์Šค์˜ ๋ฆฌ์ŠคํŠธ๋ฅผ ์–ป์–ด์˜ค๊ณ , ์ข…๋ฃŒํ•˜๊ธฐ๋ฅผ ํ•œ๊ธฐ๋ฅผ ํ•œ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด AVํ”„๋กœ๊ทธ๋žจ์„ ์ฐพ๊ฑฐ๋‚˜ ์•…์„ฑํ–‰์œ„์— ์ข…์†์„ฑ์„ ๊ฐ€์ง„ ํ”„๋กœ์„ธ์Šค๋ฅผ c0mb.tistory.com
[ํŒŒ์ด์ฌ] win32com outlook ์ž๋™ ๋ฉ”์ผ ์ฒ˜๋ฆฌ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
๋ณดํ˜ธ๋˜์–ด ์žˆ๋Š” ๊ธ€์ž…๋‹ˆ๋‹ค.
[ํŒŒ์ด์ฌ] Request ๋ชจ๋“ˆ ์˜ˆ์™ธ์ฒ˜๋ฆฌ ๋ฆฌ์ŠคํŠธ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
Python Requests ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•  ๋•Œ ์˜ˆ์™ธ์ฒ˜๋ฆฌ ๋Œ€์ƒ ๋ฆฌ์ŠคํŠธ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. ConnectionError: ์„œ๋ฒ„์— ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†๊ฑฐ๋‚˜, DNS ์กฐํšŒ์— ์‹คํŒจํ•˜๋Š” ๊ฒฝ์šฐ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. Timeout: ์š”์ฒญ ์‹œ๊ฐ„ ์ดˆ๊ณผ๊ฐ€ ๋ฐœ์ƒํ•œ ๊ฒฝ์šฐ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. TooManyRedirects: ๋ฆฌ๋””๋ ‰์…˜ ํšŸ์ˆ˜๊ฐ€ ๋„ˆ๋ฌด ๋งŽ์€ ๊ฒฝ์šฐ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. HTTPError: HTTP ์‘๋‹ต ์ฝ”๋“œ๊ฐ€ 400 ์ด์ƒ์ธ ๊ฒฝ์šฐ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. RequestException: Requests ๋ชจ๋“ˆ์—์„œ ๋ฐœ์ƒํ•˜๋Š” ๋ชจ๋“  ์˜ˆ์™ธ์˜ ๊ธฐ๋ณธ ํด๋ž˜์Šค์ž…๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์˜ˆ์™ธ๋“ค์„ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” try-except ๋ธ”๋ก์„ ์‚ฌ์šฉํ•˜์—ฌ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. import requests url = "https://www.e..
[ํŒŒ์ด์ฌ] request ๋ชจ๋“ˆ SSLError ์—๋Ÿฌ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
์˜ˆ์™ธ์ฒ˜๋ฆฌ ์ถ”๊ฐ€ except requests.exceptions.SSLError: ํ—ค๋”์ถ”๊ฐ€ requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning) request์— varify=False ์ถ”๊ฐ€ response = requests.get(url=line, timeout=1, verify=False)