728x90

Python 4

Lambda Layers 파일 만드는 방법

계층 경로를 만들때 꼭 지켜야 하는 방법이 있다. AWS에서 가이드하고 있는 각 Lambda 런타임에 대한 계층 경로를 맞춰서 업로드를 해야 한다. python을 예로 들면 압축파일을 만들때 아래 형식으로 만들어야 한다. pillow.zip │ python/PIL └ python/Pillow-5.3.0.dist-info 해당 계층 경로는 아래 링크를 클릭해서 더 자세하게 확인하시기 바란다. https://docs.aws.amazon.com/ko_kr/lambda/latest/dg/packaging-layers.html 계층 콘텐츠 패키징 - AWS Lambda 계층 콘텐츠 패키징 Lambda 계층은 추가 코드 또는 데이터를 포함하는 .zip 파일 아카이브입니다. 계층에는 일반적으로 라이브러리 종속 항목,..

Lambda 2024.01.05

nginx header log (custom header 사용)

nginx.conf 파일에서 $header_을 사용하면 된다. custom header가 제대로 나오고 있는지 확인하기 위해 custom header 값으로 로그를 찍는 테스트를 진행해 봤다. python 테스트 코드 import requests def getAuthHeader(): # http 호출 헤더값 설정 http_header = { 'test': 'test-header', 'key': 'test-key', } return http_header #header 생성 http_header = getAuthHeader() #nginx가 있는 서버 ip 입력 response = requests.get('http://serverip', headers=http_header) print (response) n..

Nginx 2023.12.11

Python No module named 'Bot' 에러 해결

Python에서 telegram을 사용할 때 No module named 'Bot'이 문구가 뜨는 경우 예제 소스 import telegram import asyncio async def telegram_alert(failtext): token = "TOKEN" bot = telegram.Bot(token) await bot.sendMessage(chat_id='chat_id', text=failtext) asyncio.run(telegram_alert("telegram_message")) 에러 내용 Exception has occurred: AttributeError partially initialized module 'telegram' has no attribute 'Bot' (most likely ..

python 2023.10.30

Python request proxy 서버 호출(Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP)

python에서 request로 URL을 호출하는 경우 아래 에러가 발생하는 경우가 있다. HTTPSConnectionPool(host='abc.host.com', port=443): Max retries exceeded with url: /connect/token (Caused by ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy', SSLError(SSLError(1, '[SSL: UNKNOWN_PR..

python 2023.10.16
728x90