[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] Upgrade to BeautifulSoup version 4



commit 8ecf1cb35d252f387e22e947d6240ad4547e1972
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Jan 11 13:25:30 2020 -0800

    Upgrade to BeautifulSoup version 4
    
    Installing beautifulsoup with python 3's pip fails with...
    
      You're trying to run a very old release of Beautiful Soup under Python 3.
      This will not work."<>"Please use Beautiful Soup 4, available through the pip
      package 'beautifulsoup4'.
    
    Attempting to use this as a drop-in replacement. Initially importing bs4 failed
    with...
    
      >>> import bs4
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/lib/python3/dist-packages/bs4/__init__.py", line 30, in <module>
          from .builder import builder_registry, ParserRejectedMarkup
        File "/usr/lib/python3/dist-packages/bs4/builder/__init__.py", line 314, in <module>
          from . import _html5lib
        File "/usr/lib/python3/dist-packages/bs4/builder/_html5lib.py", line 70, in <module>
          class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
      AttributeError: module 'html5lib.treebuilders' has no attribute '_base'
    
    Upgrading to a specific version of html5lib as per the following fixed this...
    
      https://stackoverflow.com/questions/38447738/beautifulsoup-html5lib-module-object-has-no-attribute-base
    
    Test results unchanged...
    
      before: FAILED (skips=6, failures=9, errors=194, successes=359)
      after:  FAILED (skips=6, failures=9, errors=194, successes=359)
---
 bridgedb/captcha.py                | 3 +--
 bridgedb/test/test_https.py        | 2 +-
 bridgedb/test/test_https_server.py | 2 +-
 requirements.txt                   | 3 ++-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/bridgedb/captcha.py b/bridgedb/captcha.py
index b758c09..a4753fa 100644
--- a/bridgedb/captcha.py
+++ b/bridgedb/captcha.py
@@ -65,8 +65,7 @@ import os
 import time
 import urllib.request
 
-from BeautifulSoup import BeautifulSoup
-
+from bs4 import BeautifulSoup
 from zope.interface import Interface, Attribute, implementer
 
 from bridgedb import crypto
diff --git a/bridgedb/test/test_https.py b/bridgedb/test/test_https.py
index ffd7281..b6c3e0f 100644
--- a/bridgedb/test/test_https.py
+++ b/bridgedb/test/test_https.py
@@ -31,7 +31,7 @@ import ipaddr
 import mechanize
 import os
 
-from BeautifulSoup import BeautifulSoup
+from bs4 import BeautifulSoup
 
 from twisted.trial import unittest
 from twisted.trial.reporter import TestResult
diff --git a/bridgedb/test/test_https_server.py b/bridgedb/test/test_https_server.py
index 945ea06..3c799ba 100644
--- a/bridgedb/test/test_https_server.py
+++ b/bridgedb/test/test_https_server.py
@@ -19,7 +19,7 @@ import shutil
 
 import ipaddr
 
-from BeautifulSoup import BeautifulSoup
+from bs4 import BeautifulSoup
 
 from twisted.internet import reactor
 from twisted.internet import task
diff --git a/requirements.txt b/requirements.txt
index 5769e11..eed4889 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,6 @@
 Babel==2.8.0
-BeautifulSoup==3.2.2
+beautifulsoup4==4.8.2
+html5lib==1.0b8
 Mako==1.1.1
 pycryptodome==3.9.6
 Twisted==19.10.0



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits