Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Hodackin
Copy link

Added few methods for adding, accepting and deleting friends by steam_id.

Copy link
Owner

@bukson bukson left a 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 = {
Copy link
Owner

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:
Copy link
Owner

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

"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()
Copy link
Owner

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants