mirror of
https://github.com/modelscope/modelscope.git
synced 2026-02-24 04:01:10 +01:00
Fix get_domain and endpoint (#1511)
This commit is contained in:
@@ -130,8 +130,7 @@ class HubApi:
|
||||
|
||||
self.upload_checker = UploadingCheck()
|
||||
|
||||
@staticmethod
|
||||
def _get_cookies(access_token: str):
|
||||
def _get_cookies(self, access_token: str):
|
||||
"""
|
||||
Get jar cookies for authentication from access_token.
|
||||
|
||||
@@ -142,10 +141,14 @@ class HubApi:
|
||||
jar (CookieJar): cookies for authentication.
|
||||
"""
|
||||
from requests.cookies import RequestsCookieJar
|
||||
from urllib.parse import urlparse
|
||||
|
||||
domain: str = urlparse(self.endpoint).netloc if self.endpoint else get_domain()
|
||||
|
||||
jar = RequestsCookieJar()
|
||||
jar.set('m_session_id',
|
||||
access_token,
|
||||
domain=get_domain(),
|
||||
domain=domain,
|
||||
path='/')
|
||||
return jar
|
||||
|
||||
|
||||
Reference in New Issue
Block a user