Skip to content

Commit

Permalink
Tidy up some constant values
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrance committed Jun 16, 2023
1 parent cfdf0f9 commit bbd50d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion skpy/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def getMsgs(self):
def createRaw(self, msg):
# All fields except timezone are required; 1418 = desktop client.
client = ("os=Windows; osVer=10; proc=x86; lcid=en-US; deviceType=1; country=US; "
"clientName=skype4life; clientVer=1418/9.99.0.999//skype4life")
"clientName=skype4life; clientVer={0}//skype4life").format(SkypeConnection.SKYPE_CLIENT)
resp = self.skype.conn("POST", "{0}/users/ME/conversations/{1}/messages"
.format(self.skype.conn.msgsHost, self.id),
auth=SkypeConnection.Auth.RegToken, headers={"ClientInfo": client}, json=msg)
Expand Down
7 changes: 4 additions & 3 deletions skpy/conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ def externalCall(cls, method, url, codes=(200, 201, 204, 207), **kwargs):
API_DIRECTORY = "https://skypegraph.skype.com/v2.0/search/"
# Version doesn't seem to be important, at least not for what we need.
API_CONFIG = "https://a.config.skype.com/config/v1"

USER_AGENT = "SkPy"
USER_AGENT_BROWSER = ("Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/33.0.1750.117 Safari/537.36")
SKYPE_CLIENT = "1418/9.99.0.999"

attrs = ("userId", "tokenFile", "connected", "guest")
Expand Down Expand Up @@ -822,10 +825,8 @@ def auth(self, url, name):
"""
urlId = url.split("/")[-1]
# Pretend to be Chrome on Windows (required to avoid "unsupported device" messages).
agent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " \
"Chrome/33.0.1750.117 Safari/537.36"
cookies = self.conn("GET", "{0}/{1}".format(SkypeConnection.API_JOIN, urlId),
headers={"User-Agent": agent}).cookies
headers={"User-Agent": SkypeConnection.USER_AGENT_BROWSER}).cookies
ids = self.conn("POST", "{0}/api/v2/conversation/".format(SkypeConnection.API_JOIN),
json={"shortId": urlId, "type": "wl"}).json()
token = self.conn("POST", "{0}/api/v1/users/guests".format(SkypeConnection.API_JOIN),
Expand Down

0 comments on commit bbd50d5

Please sign in to comment.