- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
Google Drive API 具有以下来自其 quickstart 的 OAuth2.0 过程最后接收 drive_service:
# Copy your credentials from the APIs Console
CLIENT_ID = 'YOUR_CLIENT_ID'
CLIENT_SECRET = 'YOUR_CLIENT_SECRET'
# Check https://developers.google.com/drive/scopes for all available scopes
OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive'
# Redirect URI for installed apps
REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'
# Path to the file to upload
FILENAME = 'document.txt'
# Run through the OAuth flow and retrieve credentials
flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI)
authorize_url = flow.step1_get_authorize_url()
print 'Go to the following link in your browser: ' + authorize_url
code = raw_input('Enter verification code: ').strip()
credentials = flow.step2_exchange(code)
# Create an httplib2.Http object and authorize it with our credentials
http = httplib2.Http()
http = credentials.authorize(http)
drive_service = build('drive', 'v2', http=http)
请注意,您将获得打印出来的变量 authorize_url。您应该使用浏览器访问它,然后确认您允许 Google Drive 访问您的信息,然后您将获得一个“验证码”。有什么方法可以避免手动干预步骤并创建一个自动执行此步骤的程序?
最佳答案
是的,您可以使用网络服务器获取不需要任何用户交互的 OAuth 回调。
基本上,您将服务器设置为检索 oauth 代码并将重定向 uri 添加到 oauth 流程,以便 oauth 将代码发送到给定的 uri,而不是告诉用户将代码放入文本框。
看看tools.run_flow() google-api-python-client 中的方法。它有非常方便的本地网络服务器 oauth 流程代码。
关于python - 无需查找验证码即可完成Google Drive API OAuth 2.0 Procedure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17892504/
我有 3 个表: 1. 学生:{id, name, roll} 2. 主题:{id, name} 3. 分数:{student_id, subject_id, marks} 我有一个返回所有学生及其分
我将制作一款完全由程序生成的空间/交易/战斗游戏。但是,我知道将整个星系的所有细节存储在内存中是不可行的。因此,我一直认为我可以使用种子来生成太阳系,并且从该太阳系,您可以使用跳跃门前往其他太阳系。问
我有一个关于 ADS 中存储过程的性能的问题。我创建了一个具有以下结构的简单数据库: CREATE TABLE MainTable ( Id INTEGER PRIMARY KEY,
我想将这个简单的东西加载到我的编辑器中: Write:-repeat,write("hi"),nl,fail. 所以它打印“嗨”。 我该怎么办? 我目前正在尝试做 File->New 并将名为 Wri
在从 c# 调用过程中显示以下错误 "Procedure or function 'CALL get_Users()'cannot be foundin database 'joomla'."` 代码
在网上找到了创建存储过程的教程,只是不明白到底什么时候需要执行创建存储过程。 是否应该在每次重新启动 MySQL 服务器时执行存储过程创建? 我是否需要在每次启动我的应用程序时都执行存储过程创建sql
我有一个包含所有例程的 MySQL 转储。当我恢复时,只有存储过程没有恢复。我从中提取 Dump 的 MySQL 版本是 5.0.77-log,我恢复到的版本是 5.6.12。 感谢任何帮助。 谢谢
我是一家大量使用存储过程(500+)的公司的新手。为了帮助学习系统,我希望有一种简单的方法来构建一个树型列表,显示系统中的所有存储过程以及它们自己调用哪些存储过程......从而创建可以执行的存储过程
我需要使用 mysqldump 和 replace 而不是 insert 并且在恢复时不删除数据库和表。但我需要删除并重新创建触发器和存储过程 为此,我将 mysqldump 与 --replace
在执行代码的过程中,我在不同的Scheme实现中遇到以下错误: Racket : application: not a procedure; expected a procedure that ca
我想将存储过程输出参数映射到一个实体。 例如, PROCEDURE ForExample @ID int, @LastUpdate datetime OUTPUT AS Update EntityTa
假设我有“myStoredProcedure”,它接受一个 Id 作为参数,并返回一个信息表。 是否可以编写类似于此的 SQL 语句? SELECT MyColumn FROM Tabl
我想将整个 sql 查询作为词法参数传递给存储过程,然后执行它。任何建议如何做到这一点? 最佳答案 你可以试试这个: create or replace procedure my_proc(pstri
考虑以下测试用例: { CompilerVersion = 21 } procedure Global(); procedure Local(); begin end; type TP
在 Azure Cosmos Db 中,是否可以从另一个存储过程调用一个存储过程?那么UDF呢?我可以从另一个 UDF、存储过程或触发器调用一个 UDF吗? 最佳答案 is there a way t
在 Azure Cosmos Db 中,是否可以从另一个存储过程调用一个存储过程?那么UDF呢?我可以从另一个 UDF、存储过程或触发器调用一个 UDF吗? 最佳答案 is there a way t
在 LINQ to Entities 中,我将存储过程的结果集映射到实体。 在存储过程中,我执行一些更新语句并通过运行 SELECT 查询并将结果集映射到实体来返回结果集。 数据库行得到正确更新,但返
创建存储过程时,BEGIN/END 块是否有用途? 例如, CREATE PROCEDURE SPNAME AS SELECT * FROM TABLE 对比 CREATE PROCEDURE S
正如您在下面看到的,我的过程有两个参数。我希望它们都是整数。但是,当我使用非整数测试该过程时,它仍然可以编译!为什么? create procedure int_arith( p_1 int, p_
我有一个 Client类(class)。在那个类里面有一个数组 losses .首先,我创建并使用客户端填充 clientsColl大批。然后对于该数组中的每个客户端,我填充其 losses大批。 然
我是一名优秀的程序员,十分优秀!