But I've been trying all kinds of things and I just learn best when given an example, and I can't find any.
First code in snapchat.py
def add_friend(self, friend):
timestamp = self._timestamp()
data = {
'action': 'add',
'friend': friend,
'timestamp': timestamp,
'username': self.username
}
params = [
self.auth_token,
timestamp
]
self.post('/friend', data, params)
Second code in test.py
username = raw_input('Enter your username: ')
password = raw_input('Enter your password: ')
s.login(username, password)
s.add_friend()
Now obv. this gives me an error, the following:
Traceback (most recent call last):
File "test.py", line 11, in <module>
s.add_friend()
TypeError: add_friend() takes exactly 2 arguments (1 given)
The point here is, I have no clue how to feed it argument, I suspect "self" (my username) is the first agument, which is given, and the name of the friend is left.
For now I want to be able to have this script ask the user the username and enter it by raw_input.
If anyone could help, that'd be great!
For those wondering.
I added this line: friend = raw_input('Enter friend name: ') Then changed this line: s.add_friend() to: s.add_friend(friend)