forked from openlp/openlp
Use urllib.urlencode()
This commit is contained in:
parent
4b5ad13eec
commit
3ea6ce9520
@ -24,10 +24,11 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import urllib2
|
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
|
||||||
import re
|
import re
|
||||||
|
import sqlite3
|
||||||
|
import urllib
|
||||||
|
import urllib2
|
||||||
|
|
||||||
from BeautifulSoup import BeautifulSoup, Tag, NavigableString
|
from BeautifulSoup import BeautifulSoup, Tag, NavigableString
|
||||||
|
|
||||||
@ -197,13 +198,14 @@ class BGExtract(BibleCommon):
|
|||||||
Chapter number
|
Chapter number
|
||||||
"""
|
"""
|
||||||
log.debug(u'get_bible_chapter %s, %s, %s', version, bookname, chapter)
|
log.debug(u'get_bible_chapter %s, %s, %s', version, bookname, chapter)
|
||||||
urlstring = u'http://www.biblegateway.com/passage/?search=%s %s' \
|
url_params = urllib.urlencode(
|
||||||
u'&version=%s' % (bookname, chapter, version)
|
{u'search': u'%s %s' % (bookname, chapter),
|
||||||
url = urlstring.replace(u' ', u'%20')
|
u'version': u'%s' % version})
|
||||||
log.debug(u'BibleGateway url = %s' % url)
|
|
||||||
# Let's get the page, and then open it in BeautifulSoup, so as to
|
# Let's get the page, and then open it in BeautifulSoup, so as to
|
||||||
# attempt to make "easy" work of bad HTML.
|
# attempt to make "easy" work of bad HTML.
|
||||||
page = urllib2.urlopen(url)
|
page = urllib2.urlopen(
|
||||||
|
u'http://www.biblegateway.com/passage/?%s' % url_params)
|
||||||
|
log.debug(u'BibleGateway url = %s' % page.geturl())
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
soup = BeautifulSoup(page)
|
soup = BeautifulSoup(page)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
Loading…
Reference in New Issue
Block a user