Skip to content

Commit

Permalink
Merge pull request #1678 from kticoder/patch-1
Browse files Browse the repository at this point in the history
Update account.py
  • Loading branch information
subzeroid authored Jan 10, 2024
2 parents ca3e66a + 65f86d7 commit 9ee9b5b
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions instagrapi/mixins/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,46 @@ def account_info(self) -> Account:
"""
result = self.private_request("accounts/current_user/?edit=true")
return extract_account(result["user"])

def change_password(
self,
old_password: str,
new_password: str,
) -> bool:
"""
Change password
Parameters
----------
new_password: str
New password
old_password: str
Old password
Returns
-------
bool
A boolean value
"""
try:
enc_old_password = self.password_encrypt(old_password)
enc_new_password = self.password_encrypt(new_password)
data = {
"enc_old_password": enc_old_password,
"enc_new_password1": enc_new_password,
"enc_new_password2": enc_new_password,
}
self.with_action_data(
{
"_uid": self.user_id,
"_uuid": self.uuid,
"_csrftoken": self.token,
}
)
result = self.private_request("accounts/change_password/", data=data)
return result
except Exception as e:
return False
def set_external_url(self, external_url) -> dict:
"""
Set new biography
Expand Down

0 comments on commit 9ee9b5b

Please sign in to comment.