def displayAbout(self): msgBox = QMessageBox() msgBox.setTextFormat(Qt.RichText) msgBox.setWindowTitle("Data Extractor for reddit") msgBox.setText(""" <p>This program uses the following open source software:<br> <a href="http://www.riverbankcomputing.co.uk/software/pyqt/intro">PyQt</a> under the GNU GPL v3 license <br> <a href="https://praw.readthedocs.org/en/v2.1.16/">PRAW (Python Reddit API Wrapper)</a> under the GNU GPL v3 license <br> <a href="http://docs.python-requests.org/en/latest/">Requests</a> under the Apache2 license <br> <a href="http://www.crummy.com/software/BeautifulSoup/">Beautiful Soup</a> under a simplified BSD licence <br> <a href="https://github.com/rg3/youtube-dl">youtube-dl</a> under an unlicense (public domain) </p> <p>This program makes use of a modified version of <a href="https://www.videolan.org/vlc/">VLC's</a> logo:<br> Copyright (c) 1996-2013 VideoLAN. This logo or a modified version may<br> be used or modified by anyone to refer to the VideoLAN project or any<br> product developed by the VideoLAN team, but does not indicate<br> endorsement by the project. </p> <p>This program makes use of a modified version of Microsoft Window's<br> .txt file icon. This is solely the property of Microsoft Windows<br> and I claim no ownership. </p> <p>This program is released under the GNU GPL v3 license<br> <a href="https://www.gnu.org/licenses/quick-guide-gplv3.html">GNU GPL v3 license page</a><br> See <a href="https://github.com/NSchrading/redditDataExtractor/blob/master/LICENSE.txt">LICENSE.txt</a> for more information. </p> """) msgBox.exec()
def viewRemainingImgurRequests(self): msgBox = QMessageBox() msgBox.setWindowTitle("Data Extractor for reddit") if self._rddtDataExtractor.imgurAPIClientID is not None: headers = { 'Authorization': 'Client-ID ' + self._rddtDataExtractor.imgurAPIClientID } apiURL = "https://api.imgur.com/3/credits" requestsSession = requests.session() requestsSession.headers[ 'User-Agent'] = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36' json = exceptionSafeJsonRequest( requestsSession, apiURL, headers=headers, stream=True, verify='RedditDataExtractor/cacert.pem') if json is not None and json.get('data') is not None and json.get( 'data').get('ClientRemaining'): msgBox.setText("You have " + str(json.get('data').get('ClientRemaining')) + " requests remaining.") else: msgBox.setText( "A problem occurred using the Imgur API. Check that you are connected to the internet and make sure your client-id is correct." ) else: msgBox.setText( "You do not currently have an Imgur client-id set. To set one, go to settings and check 'Change / Reset Client-id'" ) msgBox.exec()
def viewRemainingImgurRequests(self): msgBox = QMessageBox() msgBox.setWindowTitle("Data Extractor for reddit") if self._rddtDataExtractor.imgurAPIClientID is not None: headers = {'Authorization': 'Client-ID ' + self._rddtDataExtractor.imgurAPIClientID} apiURL = "https://api.imgur.com/3/credits" requestsSession = requests.session() requestsSession.headers[ 'User-Agent'] = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36' json = exceptionSafeJsonRequest(requestsSession, apiURL, headers=headers, stream=True, verify='RedditDataExtractor/cacert.pem') if json is not None and json.get('data') is not None and json.get('data').get('ClientRemaining'): msgBox.setText("You have " + str(json.get('data').get('ClientRemaining')) + " requests remaining.") else: msgBox.setText( "A problem occurred using the Imgur API. Check that you are connected to the internet and make sure your client-id is correct.") else: msgBox.setText( "You do not currently have an Imgur client-id set. To set one, go to settings and check 'Change / Reset Client-id'") msgBox.exec()