mirror of
				https://github.com/KevinMidboe/bulk-downloader-for-reddit.git
				synced 2025-10-29 17:40:15 +00:00 
			
		
		
		
	Little refactoring
This commit is contained in:
		@@ -14,7 +14,8 @@ from src.errors import (NoMatchingSubmissionFound, NoPrawSupport,
 | 
			
		||||
 | 
			
		||||
print = printToFile
 | 
			
		||||
 | 
			
		||||
class GetAuth:
 | 
			
		||||
def beginPraw(config,user_agent = str(socket.gethostname())):
 | 
			
		||||
    class GetAuth:
 | 
			
		||||
        def __init__(self,redditInstance,port):
 | 
			
		||||
            self.redditInstance = redditInstance
 | 
			
		||||
            self.PORT = int(port)
 | 
			
		||||
@@ -33,7 +34,9 @@ class GetAuth:
 | 
			
		||||
 | 
			
		||||
        def send_message(self, message):
 | 
			
		||||
            """Send message to client and close the connection."""
 | 
			
		||||
        self.client.send('HTTP/1.1 200 OK\r\n\r\n{}'.format(message).encode('utf-8'))
 | 
			
		||||
            self.client.send(
 | 
			
		||||
                'HTTP/1.1 200 OK\r\n\r\n{}'.format(message).encode('utf-8')
 | 
			
		||||
            )
 | 
			
		||||
            self.client.close()
 | 
			
		||||
 | 
			
		||||
        def getRefreshToken(self,*scopes):
 | 
			
		||||
@@ -67,7 +70,6 @@ class GetAuth:
 | 
			
		||||
            )
 | 
			
		||||
            return (self.redditInstance,refresh_token)
 | 
			
		||||
 | 
			
		||||
def beginPraw(config,user_agent = str(socket.gethostname())):
 | 
			
		||||
    """Start reddit instance"""
 | 
			
		||||
    
 | 
			
		||||
    scopes = ['identity','history','read']
 | 
			
		||||
@@ -245,8 +247,6 @@ def getPosts(args):
 | 
			
		||||
            raise MultiredditNotFound
 | 
			
		||||
 | 
			
		||||
    elif "submitted" in args:
 | 
			
		||||
        # TODO
 | 
			
		||||
        # USE REDDIT.USER.ME() INSTEAD WHEN "ME" PASSED AS A --USER
 | 
			
		||||
        print (
 | 
			
		||||
            "submitted posts of {user}\nsort: {sort}\n" \
 | 
			
		||||
            "time: {time}\nlimit: {limit}\n".format(
 | 
			
		||||
@@ -263,8 +263,6 @@ def getPosts(args):
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    elif "upvoted" in args:
 | 
			
		||||
        # TODO
 | 
			
		||||
        # USE REDDIT.USER.ME() INSTEAD WHEN "ME" PASSED AS A --USER
 | 
			
		||||
        print (
 | 
			
		||||
            "upvoted posts of {user}\nlimit: {limit}\n".format(
 | 
			
		||||
                user=args["user"],
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user