-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Methods for adding, accepting and deleting friends #366
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check and review my remarks, thanks
def accept_friend(self, steam_id: str) -> bool: | ||
return self._friend_ajax_request(steam_id, accept=1) | ||
|
||
_headers = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why put it here
return True if response else False | ||
|
||
@login_required | ||
def accept_friend(self, steam_id: str) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the difference between add_friend and accept_friend? seems like the only diffrerence is checking the response
steampy/client.py
Outdated
"accept_invite": accept | ||
} | ||
# returns True or json object if request was succes, otherwise False | ||
return self._session.post(url, data=data, headers=self._headers).json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should raise exception if something was wrong, otherwise return datatype should be specified not bool or dict
"steamid": steam_id | ||
} | ||
# returns True if request was succes, otherwise False | ||
# returns True even if `steam_id` has never been a friend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again if request was not succesed due to error, it should be an exception
Added few methods for adding, accepting and deleting friends by
steam_id
.