I want to be able to create an instance of a class, and call methods on this instance which will connect me to a service (SQS, if that matters). I then want to be able to call methods which will let me interact with that service.
For some reason, I keep getting this error on import:
class AmazonQueue(queue_id):
NameError: name 'queue_id' is not defined
But as far as I can tell, this isn't even getting called at import, so I shouldn't get this error.
Inside AmazonQueue is this method:
def __new__(self, queue_id):
conn = am_auth.BasicAuth()
q = conn.create_queue(queue_id)
return q
Which just returns an object representing authentication to the service, which I think SHOULD theoretically be available for other methods to run.
In my script I wanted this to run like this:
q = am_queue.AmazonQueue(queue_id='queue_id_goes_here')
and then have a method called inside AmazonQueue() like so:
q.post_message('blahblahblah')
So, why am I getting this error if I'm not even instantiating the class on import?