Exemple #1
0
 def approve(self):
     url = self.reddit_session.config['approve']
     params = {'id': self.content_id}
     response = self.reddit_session.request_json(url, params)
     urls = [self.reddit_session.config[x] for x in ['modqueue', 'spam']]
     _request.evict(urls)  # pylint: disable-msg=E1101
     return response
Exemple #2
0
 def remove(self, spam=False):
     url = self.reddit_session.config["remove"]
     params = {"id": self.content_id, "spam": "True" if spam else "False"}
     response = self.reddit_session.request_json(url, params)
     urls = [self.reddit_session.config[x] for x in ["modqueue", "spam"]]
     _request.evict(urls)  # pylint: disable-msg=E1101
     return response
Exemple #3
0
 def report(self):
     url = self.reddit_session.config['report']
     params = {'id': self.content_id}
     response = self.reddit_session.request_json(url, params)
     # pylint: disable-msg=E1101
     _request.evict([self.reddit_session.config['user']])
     return response
Exemple #4
0
 def delete(self):
     url = self.reddit_session.config["del"]
     params = {"id": self.content_id}
     response = self.reddit_session.request_json(url, params)
     # pylint: disable-msg=E1101
     _request.evict([self.reddit_session.config["user"]])
     return response
Exemple #5
0
 def approve(self):
     url = self.reddit_session.config['approve']
     params = {'id': self.content_id}
     response = self.reddit_session.request_json(url, params)
     urls = [self.reddit_session.config[x] for x in ['modqueue', 'spam']]
     _request.evict(urls)  # pylint: disable-msg=E1101
     return response
Exemple #6
0
 def report(self):
     url = self.reddit_session.config['report']
     params = {'id': self.content_id}
     response = self.reddit_session.request_json(url, params)
     # pylint: disable-msg=E1101
     _request.evict([self.reddit_session.config['user']])
     return response
Exemple #7
0
 def approve(self):
     url = self.reddit_session.config["approve"]
     params = {"id": self.content_id}
     response = self.reddit_session.request_json(url, params)
     urls = [self.reddit_session.config[x] for x in ["modqueue", "spam"]]
     _request.evict(urls)  # pylint: disable-msg=E1101
     return response
Exemple #8
0
 def remove(self, spam=False):
     url = self.reddit_session.config['remove']
     params = {'id': self.content_id,
               'spam': 'True' if spam else 'False'}
     response = self.reddit_session.request_json(url, params)
     urls = [self.reddit_session.config[x] for x in ['modqueue', 'spam']]
     _request.evict(urls)  # pylint: disable-msg=E1101
     return response
Exemple #9
0
 def remove(self, spam=False):
     url = self.reddit_session.config['remove']
     params = {'id': self.content_id,
               'spam': 'True' if spam else 'False'}
     response = self.reddit_session.request_json(url, params)
     urls = [self.reddit_session.config[x] for x in ['modqueue', 'spam']]
     _request.evict(urls)  # pylint: disable-msg=E1101
     return response
Exemple #10
0
 def save(self, unsave=False):
     """If logged in, save the content."""
     url = self.reddit_session.config["unsave" if unsave else "save"]
     params = {"id": self.content_id, "executed": "unsaved" if unsave else "saved"}
     response = self.reddit_session.request_json(url, params)
     # pylint: disable-msg=E1101
     _request.evict([self.reddit_session.config["saved"]])
     return response
Exemple #11
0
 def edit(self, text):
     url = self.reddit_session.config["edit"]
     params = {"thing_id": self.content_id, "text": text}
     response = self.reddit_session.request_json(url, params)
     # pylint: disable-msg=E1101
     _request.evict([self.reddit_session.config["user"]])
     # REDDIT: Reddit's end should only ever return a single comment
     return response["data"]["things"][0]
Exemple #12
0
 def edit(self, text):
     url = self.reddit_session.config['edit']
     params = {'thing_id': self.content_id,
               'text': text}
     response = self.reddit_session.request_json(url, params)
     # pylint: disable-msg=E1101
     _request.evict([self.reddit_session.config['user']])
     # REDDIT: Reddit's end should only ever return a single comment
     return response['data']['things'][0]
Exemple #13
0
 def save(self, unsave=False):
     """If logged in, save the content."""
     url = self.reddit_session.config['unsave' if unsave else 'save']
     params = {'id': self.content_id,
               'executed': 'unsaved' if unsave else 'saved'}
     response = self.reddit_session.request_json(url, params)
     # pylint: disable-msg=E1101
     _request.evict([self.reddit_session.config['saved']])
     return response
Exemple #14
0
 def save(self, unsave=False):
     """If logged in, save the content."""
     url = self.reddit_session.config['unsave' if unsave else 'save']
     params = {'id': self.content_id,
               'executed': 'unsaved' if unsave else 'saved'}
     response = self.reddit_session.request_json(url, params)
     # pylint: disable-msg=E1101
     _request.evict([self.reddit_session.config['saved']])
     return response
Exemple #15
0
 def edit(self, text):
     url = self.reddit_session.config['edit']
     params = {'thing_id': self.content_id,
               'text': text}
     response = self.reddit_session.request_json(url, params)
     # pylint: disable-msg=E1101
     _request.evict([self.reddit_session.config['user']])
     # REDDIT: Reddit's end should only ever return a single comment
     return response['data']['things'][0]
Exemple #16
0
 def reply(self, text):
     """Reply to the comment with the specified text."""
     # pylint: disable-msg=E1101,W0212
     response = self.reddit_session._add_comment(self.content_id, text)
     if isinstance(self, Comment):
         _request.evict([self.reddit_session.config["inbox"], self.submission.permalink])
     elif isinstance(self, Message):
         _request.evict([self.reddit_session.config["inbox"], self.reddit_session.config["sent"]])
     return response
Exemple #17
0
 def reply(self, text):
     """Reply to the comment with the specified text."""
     # pylint: disable-msg=E1101,W0212
     response = self.reddit_session._add_comment(self.content_id, text)
     if isinstance(self, Comment):
         _request.evict([self.reddit_session.config['inbox'],
                            self.submission.permalink])
     elif isinstance(self, Message):
         _request.evict([self.reddit_session.config['inbox'],
                            self.reddit_session.config['sent']])
     return response
Exemple #18
0
 def add_comment(self, text):
     """If logged in, comment on the submission using the specified text."""
     # pylint: disable-msg=E1101, W0212
     response = self.reddit_session._add_comment(self.content_id, text)
     _request.evict([self.permalink])
     return response
Exemple #19
0
 def add_comment(self, text):
     """If logged in, comment on the submission using the specified text."""
     # pylint: disable-msg=E1101, W0212
     response = self.reddit_session._add_comment(self.content_id, text)
     _request.evict([self.permalink])
     return response