Make (x-)origin header backwards-compatible to avoid breaking existing headers files (#87)
This commit is contained in:
parent
c93f66471c
commit
6405bec93f
1 changed files with 5 additions and 5 deletions
|
|
@ -103,8 +103,8 @@ class YTMusic(BrowsingMixin, WatchMixin, LibraryMixin, PlaylistsMixin, UploadsMi
|
||||||
def _send_request(self, endpoint: str, body: Dict, additionalParams: str = "") -> Dict:
|
def _send_request(self, endpoint: str, body: Dict, additionalParams: str = "") -> Dict:
|
||||||
body.update(self.context)
|
body.update(self.context)
|
||||||
if self.auth:
|
if self.auth:
|
||||||
self.headers["Authorization"] = get_authorization(self.sapisid + ' '
|
origin = self.headers.get('origin', self.headers.get('x-origin'))
|
||||||
+ self.headers['origin'])
|
self.headers["Authorization"] = get_authorization(self.sapisid + ' ' + origin)
|
||||||
response = requests.post(base_url + endpoint + params + additionalParams,
|
response = requests.post(base_url + endpoint + params + additionalParams,
|
||||||
json=body,
|
json=body,
|
||||||
headers=self.headers,
|
headers=self.headers,
|
||||||
|
|
@ -131,5 +131,5 @@ class YTMusic(BrowsingMixin, WatchMixin, LibraryMixin, PlaylistsMixin, UploadsMi
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, execType = None, execValue = None, trackback = None):
|
def __exit__(self, execType=None, execValue=None, trackback=None):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue