I'm using two files for this project. Snapchat.py and test.py
Snapchat.py contains the following (showing the important part):
def add_friend(self, username):
"""Add user as friend
Returns JSON response.
Expected messages:
Success: '{username} is now your friend!'
Pending: '{username} is private. Friend request sent.'
Failure: 'Sorry! Couldn't find {username}'
:param username: Username to add as a friend
"""
r = self._request('friend', {
'action': 'add',
'friend': username,
'username': self.username
})
return r.json()
The file test.py, that I am currently working on has the following code:
#including Snapchat in test.py
from snapchat import Snapchat
s = Snapchat()
username = raw_input('Enter your username: ')
password = raw_input('Enter your password: ')
friend = raw_input('Enter friend name: ')
s.login(username, password)
s.add_friend(friend)
The important part here is:
Returns JSON response.
Expected messages:
Success: '{username} is now your friend!'
Pending: '{username} is private. Friend request sent.'
Failure: 'Sorry! Couldn't find {username}'
I want that response printed at the end of the test.py file in the command shell.
Though I have no clue on how to do this, I have tried importing it in the test.py file and printing it, but not working.