mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 18:57:52 -06:00
Install and cloud-subscribe a package when after agreeing to the license
CURA-6983
This commit is contained in:
parent
1cf3cd8228
commit
35695e5ab6
5 changed files with 51 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
|||
from PyQt5.QtNetwork import QNetworkRequest
|
||||
|
||||
from UM.Logger import Logger
|
||||
from UM.TaskManagement.HttpRequestScope import DefaultUserAgentScope
|
||||
from cura.API import Account
|
||||
from cura.CuraApplication import CuraApplication
|
||||
|
@ -14,6 +15,10 @@ class UltimakerCloudScope(DefaultUserAgentScope):
|
|||
def request_hook(self, request: QNetworkRequest):
|
||||
super().request_hook(request)
|
||||
token = self._account.accessToken
|
||||
if not self._account.isLoggedIn or token is None:
|
||||
Logger.warning("Cannot add authorization to Cloud Api request")
|
||||
return
|
||||
|
||||
header_dict = {
|
||||
"Authorization": "Bearer {}".format(token)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue