동행복권 사이트내에 계정에 예치금만 넣어두시면 이후 매주 로또를 구입하고 당첨을 체크하여 알려드려요!
🚧 현재는 MVP 수준으로 구현되어 있어 예상하지 못한 오류가 발생할 수 있습니다.
- 레포지토리를
fork
합니다. - Settings - Secrets - Add a new secret 메뉴로 들어갑니다
- 환경 변수들을 만들어 줍니다 (.env.sample 참조)
- 매주 로또 구매 및 당첨 과정을 자동으로 알려드려요 🎉
매주 동행복권 자동구매 하고 당첨되면 알려드려요 💰 (Github Action)
동행복권 사이트내에 계정에 예치금만 넣어두시면 이후 매주 로또를 구입하고 당첨을 체크하여 알려드려요!
🚧 현재는 MVP 수준으로 구현되어 있어 예상하지 못한 오류가 발생할 수 있습니다.
fork
합니다.lottery-bot 레포를 유용하게 잘 사용하고 있던 중 아래와 같이 GitHub Actions에서 오류가 발생하는 현상이 발생했습니다.
스케쥴에 의해 실행됐을 때의 오류 로그는 아래와 같습니다.
python3 controller.py buy
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/urllib3/connection.py", line ***69, in _new_conn
conn = connection.create_connection(
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
TimeoutError: [Errno ***0] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/urllib3/connectionpool.py", line ***0***0, in _validate_conn
conn.connect()
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/urllib3/connection.py", line ***8***, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f004dad2700>: Failed to establish a new connection: [Errno ***0] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.dhlottery.co.kr', port=443): Max retries exceeded with url: /common.do?method=main (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f004dad2700>: Failed to establish a new connection: [Errno ***0] Connection timed out'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/runner/work/lottery-bot/lottery-bot/controller.py", line 96, in <module>
run()
File "/home/runner/work/lottery-bot/lottery-bot/controller.py", line 90, in run
buy()
File "/home/runner/work/lottery-bot/lottery-bot/controller.py", line 78, in buy
response = buy_lotto645(globalAuthCtrl, count, mode)
File "/home/runner/work/lottery-bot/lottery-bot/controller.py", line ***4, in buy_lotto645
response = lotto.buy_lotto645(authCtrl, cnt, _mode)
File "/home/runner/work/lottery-bot/lottery-bot/lotto645.py", line 50, in buy_lotto645
self._generate_body_for_auto_mode(cnt, requirements)
File "/home/runner/work/lottery-bot/lottery-bot/lotto645.py", line 77, in _generate_body_for_auto_mode
"round": self._get_round(),
File "/home/runner/work/lottery-bot/lottery-bot/lotto645.py", line ***[26](https://github.com/Zerohertz/lottery-bot/actions/runs/6378772586/job/17310004691#step:5:27), in _get_round
res = requests.get("https://www.dhlottery.co.kr/common.do?method=main")
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/requests/api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/requests/api.py", line 6***, in request
return session.request(method=method, url=url, **kwargs)
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/opt/hostedtoolcache/Python/3.9.***8/x64/lib/python3.9/site-packages/requests/adapters.py", line 5***6, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.dhlottery.co.kr', port=443): Max retries exceeded with url: /common.do?method=main (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f004dad[27](https://github.com/Zerohertz/lottery-bot/actions/runs/6378772586/job/17310004691#step:5:28)00>: Failed to establish a new connection: [Errno ***0] Connection timed out'))
make: *** [Makefile:5: buy] Error ***
수동 실행에 의해 실행됐을 때의 오류 로그는 아래와 같습니다.
**mmake buy
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/[3](https://github.com/Zerohertz/lottery-bot/actions/runs/6385139481/job/17329241251#step:5:3).9.***8/x6[4](https://github.com/Zerohertz/lottery-bot/actions/runs/6385139481/job/17329241251#step:5:4)
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.***8/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.***8/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.***8/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.***8/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.***8/x64/lib
USERNAME: ***
PASSWORD: ***
COUNT: ***
SLACK_WEBHOOK_URL:
DISCORD_WEBHOOK_URL: ***
python3 controller.py buy
Traceback (most recent call last):
File "/home/runner/work/lottery-bot/lottery-bot/controller.py", line 96, in <module>
run()
File "/home/runner/work/lottery-bot/lottery-bot/controller.py", line 90, in run
buy()
File "/home/runner/work/lottery-bot/lottery-bot/controller.py", line 78, in buy
response = buy_lotto64[5](https://github.com/Zerohertz/lottery-bot/actions/runs/6385139481/job/17329241251#step:5:5)(globalAuthCtrl, count, mode)
File "/home/runner/work/lottery-bot/lottery-bot/controller.py", line ***4, in buy_lotto[6](https://github.com/Zerohertz/lottery-bot/actions/runs/6385139481/job/17329241251#step:5:6)45
response = lotto.buy_lotto645(authCtrl, cnt, _mode)
File "/home/runner/work/lottery-bot/lottery-bot/lotto645.py", line 4[7](https://github.com/Zerohertz/lottery-bot/actions/runs/6385139481/job/17329241251#step:5:7), in buy_lotto645
requirements = self._getRequirements(headers)
File "/home/runner/work/lottery-bot/lottery-bot/lotto645.py", line ***[20](https://github.com/Zerohertz/lottery-bot/actions/runs/6385139481/job/17329241251#step:5:21), in _getRequirements
draw_date = soup.find("input", id="ROUND_DRAW_DATE").get('value')
AttributeError: 'NoneType' object has no attribute 'get'
make: *** [Makefile:5: buy] Error ***
맨 처음의 사진에서 알 수 있듯, 조금 시간이 지난 뒤에 수동 실행을 했을 때는 올바르게 잘 실행이 됐었습니다.
혹시 해당 에러에 대해 원인을 아신다면 도움 부탁드립니다!
감사합니다.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.