mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 06:45:14 +08:00
Not logged in for API calls is not a warning
Many requests are made without being logged in, such as to get the list of plug-ins when opening the Marketplace. Contributes to issue CURA-7501.
This commit is contained in:
parent
8f9e0da400
commit
df69d543a2
@ -7,10 +7,9 @@ from cura.CuraApplication import CuraApplication
|
|||||||
|
|
||||||
|
|
||||||
class UltimakerCloudScope(DefaultUserAgentScope):
|
class UltimakerCloudScope(DefaultUserAgentScope):
|
||||||
"""Add an Authorization header to the request for Ultimaker Cloud Api requests.
|
"""
|
||||||
|
Add an Authorization header to the request for Ultimaker Cloud Api requests, if available.
|
||||||
When the user is not logged in or a token is not available, a warning will be logged
|
Also add the user agent headers (see DefaultUserAgentScope).
|
||||||
Also add the user agent headers (see DefaultUserAgentScope)
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, application: CuraApplication):
|
def __init__(self, application: CuraApplication):
|
||||||
@ -22,7 +21,7 @@ class UltimakerCloudScope(DefaultUserAgentScope):
|
|||||||
super().requestHook(request)
|
super().requestHook(request)
|
||||||
token = self._account.accessToken
|
token = self._account.accessToken
|
||||||
if not self._account.isLoggedIn or token is None:
|
if not self._account.isLoggedIn or token is None:
|
||||||
Logger.warning("Cannot add authorization to Cloud Api request")
|
Logger.debug("User is not logged in for Cloud API request to {url}".format(url = request.url().toDisplayString()))
|
||||||
return
|
return
|
||||||
|
|
||||||
header_dict = {
|
header_dict = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user