示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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]
示例#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]
示例#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
示例#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
示例#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]
示例#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
示例#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
示例#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
示例#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