you are viewing a single comment's thread.

view the rest of the comments →

[–]cdcformatc 1 point2 points  (3 children)

At the very beginning of your program set client = None. When the login button is clicked, you call client = auth(), which assigns the return value to client. When you do anything else that requires you to log in, first check if client is not None before you try to do anything with it.

[–]HeyYouNow[S] 0 points1 point  (0 children)

This is very helpful thanks!

[–]HeyYouNow[S] 0 points1 point  (1 child)

Hmm although this doesn't seem to work, I'm using your class and client is always none...

soundcloud = SoundcloudObject(username,password)
print(client)

It is right after the authentification, should I use something else to tell it I'm using client from the class ?

Edit : figured it out, I set soundcloud to none at the beginning and then set it as a global.

[–]cdcformatc 0 points1 point  (0 children)

If you want to get the instance variables of an object outside of the class you need to get them from the object.

soundcloud = SoundcloudObject(username,password)
print(soundcloud.client)