python requests 오류: Temporary failure in name resolution mahler83, 2020-10-132023-07-19 간단하게 requests.get(url) 이런 식으로 웹페이지를 요청하는 코드에서 다음과 같은 오류가 발생했다. 로컬에서는 동작하는데 서버에 올리니 동작을 안 하는 상황. Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 72, in get return request('get', url, params=params, **kwargs) File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 508, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='xxx.xxx.xxx', port=443): Max retries exceeded with url: / (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)) 로컬에서는 동작하는데, AWS EC2 instance에서 저런 오류가 나는 것은 DNS resolution이 안되는 것이라고 생각해서 DNS 설정에 다음을 추가해줬다. /etc/resolv.conf 파일에 다음과 같이 구글 DNS를 추가 nameserver 8.8.8.8 그 뒤로는 잘 동작함. 오예. <2020년 10월 19일 추가> 서버가 재시작 되었는데, /etc/resolv.conf 파일이 자동으로 초기화된다.찾아보니까 /sbin/dhclient-script 에서 매번 자동으로 생성되는 파일이고, /etc/sysconfig/network-scripts/ifcfg-eth0 에 다음 내용을 맨 마지막에 추가해서 구글 DNS 서버가 자동으로 추가될 수 있게 할 수 있다. DNS1="8.8.8.8"DNS2="기본 DNS를 입력" 참고자료: https://gunnm.tistory.com/141 Share this:TwitterFacebook AWS Tips & Techs Web development pythonrequests
How to check MySQL slow queries in real-time 2014-02-162023-07-19 Open up your console and type in the following watch -n 1 ‘mysqladmin -uroot -pyourbeautifulpassword “processlist”‘ This will display the queries that are currently under execution and will be refreshed every 1 second. Get a screenshot when you find queries that you suspect to slow down your server performance. Optimize… Share this:TwitterFacebook Read More
브라우저 호환 가능하게 해주는 normalize.css 2012-02-292023-07-19 http://nicolasgallagher.com/about-normalize-css/ 기존에 많이 쓰던 reset.css 와 비슷한데, 주석이 잘 달려있고, 기본으로 이용해도 margin padding 등이 적절하게 잡혀있어서 예쁘다 Share this:TwitterFacebook Read More
Cannot start session without errors in phpMyAdmin 2013-08-212023-07-19 Error: Token Mismatch Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly. 이런 류의 오류가 계속 발생하는 현상을 겪었다. CentOS에서는 phpMyAdmin을 기본 리포지터리에서 제공하지 않는 바람에 수동 설치하느라고 애먹었다. session 폴더를 따로 지정해주지 않는 경우 “/var/lib/php/session” 폴더를… Share this:TwitterFacebook Read More