質問編集履歴
2
更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
|
5
|
+
Google Driveにデータをアップロード
|
6
6
|
|
7
7
|
|
8
8
|
|
@@ -11,111 +11,3 @@
|
|
11
11
|
プログラムを実行すると、まず、**Authentication successful.**とGoogleの認証は通りますが、
|
12
12
|
|
13
13
|
その後、次のエラーが発生しており、アップロードが実行できません。
|
14
|
-
|
15
|
-
**発生しているエラー**
|
16
|
-
|
17
|
-
```text
|
18
|
-
|
19
|
-
Authentication successful.
|
20
|
-
|
21
|
-
Traceback (most recent call last):
|
22
|
-
|
23
|
-
File "./ptest.py", line 15, in <module>
|
24
|
-
|
25
|
-
gauth.CommandLineAuth()
|
26
|
-
|
27
|
-
File "/home/pi/.local/lib/python2.7/site-packages/pydrive/auth.py", line 125, in _decorated
|
28
|
-
|
29
|
-
self.Auth(code)
|
30
|
-
|
31
|
-
File "/home/pi/.local/lib/python2.7/site-packages/pydrive/auth.py", line 496, in Auth
|
32
|
-
|
33
|
-
self.Authorize()
|
34
|
-
|
35
|
-
File "/home/pi/.local/lib/python2.7/site-packages/pydrive/auth.py", line 523, in Authorize
|
36
|
-
|
37
|
-
self.service = build('drive', 'v2', http=self.http)
|
38
|
-
|
39
|
-
File "/home/pi/.local/lib/python2.7/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
|
40
|
-
|
41
|
-
return wrapped(*args, **kwargs)
|
42
|
-
|
43
|
-
File "/home/pi/.local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 223, in build
|
44
|
-
|
45
|
-
requested_url, discovery_http, cache_discovery, cache, developerKey)
|
46
|
-
|
47
|
-
File "/home/pi/.local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 273, in _retrieve_discovery_doc
|
48
|
-
|
49
|
-
resp, content = http.request(actual_url)
|
50
|
-
|
51
|
-
File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/transport.py", line 175, in new_request
|
52
|
-
|
53
|
-
redirections, connection_type)
|
54
|
-
|
55
|
-
File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/transport.py", line 282, in request
|
56
|
-
|
57
|
-
connection_type=connection_type)
|
58
|
-
|
59
|
-
File "/home/pi/.local/lib/python2.7/site-packages/httplib2/__init__.py", line 2135, in request
|
60
|
-
|
61
|
-
cachekey,
|
62
|
-
|
63
|
-
File "/home/pi/.local/lib/python2.7/site-packages/httplib2/__init__.py", line 1796, in _request
|
64
|
-
|
65
|
-
conn, request_uri, method, body, headers
|
66
|
-
|
67
|
-
File "/home/pi/.local/lib/python2.7/site-packages/httplib2/__init__.py", line 1701, in _conn_request
|
68
|
-
|
69
|
-
conn.connect()
|
70
|
-
|
71
|
-
File "/home/pi/.local/lib/python2.7/site-packages/httplib2/__init__.py", line 1411, in connect
|
72
|
-
|
73
|
-
raise SSLHandshakeError(e)
|
74
|
-
|
75
|
-
httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)
|
76
|
-
|
77
|
-
```
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
##プログラムコード
|
82
|
-
|
83
|
-
```Python
|
84
|
-
|
85
|
-
# 必要なライブラリのインポート
|
86
|
-
|
87
|
-
from pydrive.auth import GoogleAuth
|
88
|
-
|
89
|
-
from pydrive.drive import GoogleDrive
|
90
|
-
|
91
|
-
#import ssl
|
92
|
-
|
93
|
-
#ssl._create_default_https_context = ssl._create_unverified_context
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
from httplib2 import Http
|
98
|
-
|
99
|
-
http = Http(disable_ssl_certificate_validation=True)
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
# OAuth認証を行う
|
104
|
-
|
105
|
-
gauth = GoogleAuth()
|
106
|
-
|
107
|
-
gauth.CommandLineAuth()
|
108
|
-
|
109
|
-
drive = GoogleDrive(gauth)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
# テキストをGoogleドライブに書き込む
|
114
|
-
|
115
|
-
f = drive.CreateFile({'title': 'test.txt'})
|
116
|
-
|
117
|
-
f.SetContentString('テスト')
|
118
|
-
|
119
|
-
f.Upload()
|
120
|
-
|
121
|
-
```
|
1
誤記訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -78,20 +78,6 @@
|
|
78
78
|
|
79
79
|
|
80
80
|
|
81
|
-
##試したこと
|
82
|
-
|
83
|
-
**from httplib2 import Http**
|
84
|
-
|
85
|
-
**http = Http(disable_ssl_certificate_validation=True)**
|
86
|
-
|
87
|
-
と記述して、
|
88
|
-
|
89
|
-
SSL証明書のチェックを無効に設定してみましたが、エラーの発生状況は変わりませんでした。
|
90
|
-
|
91
|
-
なにか解決する方法はありますでしょうか?
|
92
|
-
|
93
|
-
|
94
|
-
|
95
81
|
##プログラムコード
|
96
82
|
|
97
83
|
```Python
|