from redis import Redis as Redis
from ghettoq.backends.base import BaseBackend


class RedisBackend(BaseBackend):

    def establish_connection(self):
        return Redis(host=self.host, port=self.port, db=self.database,
                     password=self.password)

    def put(self, queue, message):
        self.client.push(queue, message, head=False)

    def get(self, queue):
        return self.client.pop(queue)

    def purge(self, queue):
        return self.client.delete(queue)

from redis import Redis as Redis
from ghettoq.backends.base import BaseBackend

DEFAULT_PORT = 6379


class RedisBackend(BaseBackend):

    def establish_connection(self):
        self.port = self.port or DEFAULT_PORT
        return Redis(host=self.host, port=self.port, db=self.database,
                     password=self.password)

    def put(self, queue, message):
        self.client.lpush(queue, message)

    def get(self, queue):
        return self.client.rpop(queue)

    def purge(self, queue):
        return self.client.delete(queue)

Use rpop/rpush instead of deprecated pop/push (conforming to redis 1.x)
Use rpop/rpush instead of deprecated pop/push (conforming to redis 1.x)

  from redis import Redis as Redis
  from ghettoq.backends.base import BaseBackend
+ 
+ DEFAULT_PORT = 6379
  
  
  class RedisBackend(BaseBackend):
  
      def establish_connection(self):
+         self.port = self.port or DEFAULT_PORT
          return Redis(host=self.host, port=self.port, db=self.database,
                       password=self.password)
  
      def put(self, queue, message):
-         self.client.push(queue, message, head=False)
+         self.client.lpush(queue, message)
  
      def get(self, queue):
-         return self.client.pop(queue)
+         return self.client.rpop(queue)
  
      def purge(self, queue):
          return self.client.delete(queue)
  
Use rpop/rpush instead of deprecated pop/push (conforming to redis 1.x)
## Code Before:
from redis import Redis as Redis
from ghettoq.backends.base import BaseBackend


class RedisBackend(BaseBackend):

    def establish_connection(self):
        return Redis(host=self.host, port=self.port, db=self.database,
                     password=self.password)

    def put(self, queue, message):
        self.client.push(queue, message, head=False)

    def get(self, queue):
        return self.client.pop(queue)

    def purge(self, queue):
        return self.client.delete(queue)

## Instruction:
Use rpop/rpush instead of deprecated pop/push (conforming to redis 1.x)
## Code After:
from redis import Redis as Redis
from ghettoq.backends.base import BaseBackend

DEFAULT_PORT = 6379


class RedisBackend(BaseBackend):

    def establish_connection(self):
        self.port = self.port or DEFAULT_PORT
        return Redis(host=self.host, port=self.port, db=self.database,
                     password=self.password)

    def put(self, queue, message):
        self.client.lpush(queue, message)

    def get(self, queue):
        return self.client.rpop(queue)

    def purge(self, queue):
        return self.client.delete(queue)
