diff --git a/dosagelib/cmd.py b/dosagelib/cmd.py index 557d9eb53..dacd7aaa2 100644 --- a/dosagelib/cmd.py +++ b/dosagelib/cmd.py @@ -203,17 +203,8 @@ def vote_comic(scraperobj): out.context = scraperobj.name try: name = scraperobj.name - answer = scraperobj.vote() - out.debug(u'Vote answer %r' % answer) - if answer == 'counted': - url = configuration.Url + 'comics/%s.html' % name.replace('/', '_') - out.info(u'Vote submitted. Votes are updated regularly at %s.' % url) - elif answer == 'no': - out.info(u'Vote not submitted - your vote has already been submitted before.') - elif answer == 'noname': - out.warn(u'The comic %s cannot be voted.' % name) - else: - out.warn(u'Error submitting vote parameters: %r' % answer) + scraperobj.vote() + out.info(u'Vote submitted.') except Exception as msg: out.exception(msg) errors += 1 diff --git a/dosagelib/configuration.py b/dosagelib/configuration.py index 23bebcd23..b4671b967 100644 --- a/dosagelib/configuration.py +++ b/dosagelib/configuration.py @@ -13,7 +13,7 @@ App = AppName + u' ' + __version__ Maintainer = u'Tobias Gruetzmacher' MaintainerEmail = u'tobias-dosage@23.gs' -Url = u'http://dosage.rocks/' +Url = u'https://dosage.rocks/' SupportUrl = u'https://github.com/webcomics/dosage/issues' UserAgent = u"Mozilla/5.0 (compatible; %s/%s; +%s)" % (AppName, __version__, Url) @@ -25,4 +25,4 @@ Freeware = AppName + u""" comes with ABSOLUTELY NO WARRANTY! This is free software, and you are welcome to redistribute it under certain conditions. Look at the file `COPYING' within this distribution.""" -VoteUrl = "http://gaecounter.appspot.com/" +VoteUrl = "https://buildbox.23.gs/count/" diff --git a/dosagelib/scraper.py b/dosagelib/scraper.py index 025d20370..fbc0d8d28 100644 --- a/dosagelib/scraper.py +++ b/dosagelib/scraper.py @@ -259,11 +259,10 @@ class Scraper(object): def vote(self): """Cast a public vote for this comic.""" - url = configuration.VoteUrl + 'count/' uid = get_system_uid() data = {"name": self.name.replace('/', '_'), "uid": uid} - page = urlopen(url, self.session, data=data) - return page.text + response = self.session.post(configuration.VoteUrl, data=data) + response.raise_for_status() def get_download_dir(self, basepath): """Try to find the corect download directory, ignoring case diff --git a/tests/httpmocks.py b/tests/httpmocks.py index 5ca7c18ec..c328fc0c1 100644 --- a/tests/httpmocks.py +++ b/tests/httpmocks.py @@ -54,4 +54,4 @@ def zenpencils(): add(GET, re.compile(r'https://cdn-zenpencils\.netdna-ssl\.com/wp-content/uploads/.*\.jpg'), _img(), content_type='image/jpeg') def vote(): - add(POST, 'http://gaecounter.appspot.com/count/', 'no') + add(POST, 'https://buildbox.23.gs/count/', '') diff --git a/tests/test_vote.py b/tests/test_vote.py index 801897db3..c8d3fbb00 100644 --- a/tests/test_vote.py +++ b/tests/test_vote.py @@ -20,5 +20,4 @@ class TestVote(object): @responses.activate def test_vote(self): httpmocks.vote() - answer = ATestScraper('Test_Test').vote() - assert answer in ('counted', 'no'), 'invalid answer %r' % answer + ATestScraper('Test_Test').vote()