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
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
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
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
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
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
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
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]
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]
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
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
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
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