Skip to content

Commit

Permalink
Merge branch 'release/0.8.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzeman committed Dec 29, 2014
2 parents 9656a3e + d3eb29f commit 6c27ffa
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include requirements.txt
2 changes: 1 addition & 1 deletion spotify/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.8.3'
__version__ = '0.8.4'

try:
from spotify.client import Spotify
Expand Down
2 changes: 1 addition & 1 deletion spotify/components/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from requests_futures.sessions import FuturesSession
import logging

USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1941.0 Safari/537.36'
USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2224.3 Safari/537.36'

log = logging.getLogger(__name__)

Expand Down
28 changes: 27 additions & 1 deletion spotify/components/connection.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from spotify.components.base import Component
from spotify.components.base import Component, USER_AGENT
from spotify.core.helpers import repr_trim
from spotify.core.request import Request

from pyemitter import Emitter
from threading import Lock, Timer
from ws4py import WS_VERSION
from ws4py.client.threadedclient import WebSocketClient
import json
import logging
Expand Down Expand Up @@ -208,6 +209,31 @@ def __init__(self, connection, *args, **kwargs):

self.daemon = True

@property
def handshake_headers(self):
"""
List of headers appropriate for the upgrade
handshake.
"""
headers = [
('Host', self.host),
('Connection', 'Upgrade'),
('Upgrade', 'websocket'),
('Origin', self.url),
('Sec-WebSocket-Version', str(max(WS_VERSION))),
('User-Agent', USER_AGENT),

('Sec-WebSocket-Key', self.key.decode('utf-8')),
]

if self.protocols:
headers.append(('Sec-WebSocket-Protocol', ','.join(self.protocols)))

if self.extra_headers:
headers.extend(self.extra_headers)

return headers

def opened(self):
self.emit('open')

Expand Down

0 comments on commit 6c27ffa

Please sign in to comment.