커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
Mongo DB 연결해도 데이터베이스 입력이 안됩니다.
undefined주차
북마크
이*샘
댓글
6
추천
0
조회수
17
조회수
17
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


Mongo DB 부터 막혔습니다.. 연결해서 데이터를 올리고 싶은데, 아무런 동작도 하지 않고 아래와 같이 에러가 뜹니다. 도와주세요.



스파르타 즉문즉답




작성한 코드 및 에러 메세지

import requests
from bs4 import BeautifulSoup


headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'}
data = requests.get('mongodb://sparta:<password>@ac-2eqwte3-shard-00-00.cs6prtt.mongodb.net:27017,ac-2eqwte3-shard-00-01.cs6prtt.mongodb.net:27017,ac-2eqwte3-shard-00-02.cs6prtt.mongodb.net:27017/?ssl=true&replicaSet=atlas-u3fkso-shard-0&authSource=admin&retryWrites=true&w=majority', tlsCAFile=ca)


soup = BeautifulSoup(data.text, 'html.parser')


trs = soup.select('#old_content > table > tbody > tr')


for tr in trs:
    a = tr.select_one('td.title > div > a')
    if a is not None:
        rank = tr.select_one('td:nth-child(1) > img')['alt']
        title = a.text
        star = tr.select_one('td.point').text
        doc = {
            'title':title,
            'rank':rank,
            'star':star
        }
        db.movies.insert_one(doc)




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴