Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
yaq
yaqd-gdrive
Commits
448bb2d9
Commit
448bb2d9
authored
May 15, 2020
by
Kyle Sunden
Committed by
Blaise Thompson
May 15, 2020
Browse files
YEP-106: update logging calls
parent
747aba79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
CHANGELOG.md
CHANGELOG.md
+1
-0
yaqd_gdrive/_gdrive.py
yaqd_gdrive/_gdrive.py
+7
-9
No files found.
CHANGELOG.md
View file @
448bb2d9
...
...
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
### Changed
-
from now on, yaqd-gdrive will use calendar based versioning
-
cleanup repository
-
Use daemon level loggers, see
[
YEP-106
](
https://yeps.yaq.fyi/106
)
## [0.2.0]
...
...
yaqd_gdrive/_gdrive.py
View file @
448bb2d9
...
...
@@ -14,8 +14,6 @@ import aiohttp.web # type: ignore
import
appdirs
# type: ignore
import
yaqd_core
logger
=
yaqd_core
.
logging
.
getLogger
(
__name__
)
logger
.
setLevel
(
yaqd_core
.
logging
.
INFO
)
UploadItem
=
collections
.
namedtuple
(
"UploadItem"
,
"kind name path parent client_id"
,
defaults
=
[
None
]
...
...
@@ -121,14 +119,14 @@ class GDrive(yaqd_core.Base):
"grant_type"
:
"authorization_code"
,
},
)
as
res
:
logger
.
debug
(
await
res
.
text
())
self
.
logger
.
debug
(
await
res
.
text
())
res
.
raise_for_status
()
json
=
await
res
.
json
()
self
.
_access_token
=
json
[
"access_token"
]
self
.
_refresh_token
=
json
[
"refresh_token"
]
async
def
_use_refresh_token
(
self
):
logger
.
info
(
"Refreshing token"
)
self
.
logger
.
info
(
"Refreshing token"
)
async
with
self
.
_http_session
.
post
(
self
.
_token_url
,
json
=
{
...
...
@@ -160,7 +158,7 @@ class GDrive(yaqd_core.Base):
params
=
{
"uploadType"
:
"multipart"
},
data
=
mpwriter
,
)
as
res
:
logger
.
debug
(
await
res
.
text
())
self
.
logger
.
debug
(
await
res
.
text
())
return
res
async
def
_create_folder
(
self
,
name
,
parent
,
*
,
id_
=
None
):
...
...
@@ -180,7 +178,7 @@ class GDrive(yaqd_core.Base):
params
=
{
"uploadType"
:
"multipart"
},
data
=
mpwriter
,
)
as
res
:
logger
.
debug
(
await
res
.
text
())
self
.
logger
.
debug
(
await
res
.
text
())
return
res
@
refresh_oauth
...
...
@@ -243,7 +241,7 @@ class GDrive(yaqd_core.Base):
async
def
_upload
(
self
):
while
True
:
logger
.
debug
(
"_upload"
,
len
(
self
.
_upload_queue
))
self
.
logger
.
debug
(
"_upload"
,
len
(
self
.
_upload_queue
))
while
self
.
_upload_queue
:
self
.
_busy
=
True
try
:
...
...
@@ -260,7 +258,7 @@ class GDrive(yaqd_core.Base):
except
FileNotFoundError
:
self
.
_upload_queue
.
pop
(
0
)
except
BaseException
as
e
:
logger
.
error
(
e
)
self
.
logger
.
error
(
e
)
self
.
_upload_queue
.
append
(
self
.
_upload_queue
.
pop
(
0
))
else
:
try
:
...
...
@@ -299,7 +297,7 @@ class GDrive(yaqd_core.Base):
else
:
self
.
_upload_queue
.
append
(
UploadItem
(
**
item
))
except
BaseException
as
e
:
logger
.
error
(
e
)
self
.
logger
.
error
(
e
)
self
.
_copy_queue
.
append
(
self
.
_copy_queue
.
pop
(
0
))
else
:
self
.
_copy_queue
.
pop
(
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment