Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit 677b7d1

Browse files
committed
Resolves 404 error when updating the avatar
setAvatar uses the wrong endpoint and throws a 404 error. This commit updates the endpoint and sets the correct header in order to upload the avatar
1 parent 055a24f commit 677b7d1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

skpy/conn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def externalCall(cls, method, url, codes=(200, 201, 204, 207), **kwargs):
127127
API_MSACC = "https://login.live.com"
128128
API_EDGE = "https://edge.skype.com/rps/v1/rps/skypetoken"
129129
API_USER = "https://api.skype.com"
130+
API_AVATAR = "https://avatar.skype.com"
130131
API_PROFILE = "https://profile.skype.com/profile/v1"
131132
API_OPTIONS = "https://options.skype.com/options/v1/users/self/options"
132133
API_JOIN = "https://join.skype.com"

skpy/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ def setAvatar(self, image):
141141
Args:
142142
image (file): a file-like object to read the image from
143143
"""
144-
self.conn("PUT", "{0}/users/{1}/profile/avatar".format(SkypeConnection.API_USER, self.userId),
145-
auth=SkypeConnection.Auth.SkypeToken, data=image.read())
144+
self.conn("PUT", "{0}/v1/avatars/{1}".format(SkypeConnection.API_AVATAR, self.userId),
145+
auth=SkypeConnection.Auth.SkypeToken, data=image.read(), headers={'Content-type': 'image/jpeg'})
146146

147147
def getUrlMeta(self, url):
148148
"""

0 commit comments

Comments
 (0)