当前位置: 首页 > news >正文

网站开发背景怎么写郑州seo代理外包公司

网站开发背景怎么写,郑州seo代理外包公司,西安网站制作公司哪,在线咨询平台系统参考:使用 Python 将文件上传到 Google 云端硬盘_迹忆客 第 1 步:Google API Playground 我们可以通过搜索 Google 找到更多关于 Google API Playground 的信息。 我们必须单击第一个链接才能继续前进。 选择第一个链接后,我们会自动进入下一…

参考:使用 Python 将文件上传到 Google 云端硬盘_迹忆客

第 1 步:Google API Playground

我们可以通过搜索 Google 找到更多关于 Google API Playground 的信息。 我们必须单击第一个链接才能继续前进。

搜索 Google api playground

选择第一个链接后,我们会自动进入下一个页面,如下:

重定向到 Google 开发人员

第 2 步:Google 云端硬盘 API

在 Google Developers 页面上,我们必须找到 Drive API 以及其他选项。

我们将搜索名为 Drive API 3 的选项并选择它。 当我们选择它时,一个链接列表将出现在我们面前。

搜索 Drive api v3

我们必须选择链接列表中显示的第一个链接。 如果我们要选择任何东西,我们需要先点击它,然后我们会看到它旁边出现一个复选标记。

所以在这里我们将点击第一个链接。

单击授权 api

在大约三到五秒钟的短暂等待后,我们将被重定向到我们的 Gmail 帐户。

第 3 步:Gmail 帐户

单击我们要将文件上传到其驱动器的 Gmail 帐户,然后按照屏幕上的说明进行操作。 屏幕上将显示取消和允许两个选项。

要继续,我们必须从下拉菜单中选择允许。 当我们点击 Google 帐户时,Google Auth 会询问我们是否要允许该操作。

允许 Gmail 帐户

第四步:授权码

当我们最终放弃并单击“允许”按钮时,我们将被重定向到一个新页面,我们可以在其中检索我们的权限代码。

代码授权

另一方面,我们不会复制它,因为我们不需要授权码。 相反,我们将单击交易授权码的按钮来访问令牌。

点击兑换授权码

单击按钮后,我们将获得访问令牌。

访问令牌

在处理 Python 代码时,我们需要复制访问令牌并将其存储在安全的地方。 我们将使用 Python 来方便将文件上传到我们的 Google 云端硬盘,并且需要访问令牌。


在 Google Drive 中上传文件的 Python 代码

第 1 步:库

首先,导入所需的库和模块。 在这种情况下,我们必须导入 JSON 和请求。

我们使用 JSON 上传文件和请求 API 以允许我们上传文件。

示例代码:

import json
import requests

第 2 步:访问令牌

其次,我们将创建一个字典并使用访问令牌作为其中一个键的值。 在这个场景中,授权是关键,访问令牌是价值。

示例代码:

headers = {"Authorization": "Bearer Paste your access token here"}

我们可以在 Bearer 后面复制并粘贴 access token,只用空格。

第 3 步:文件名

现在我们可以创建另一个字典并为我们要上传的文件命名。

示例代码:

para = {"name": "##name for python uploaded file####",
}

第 4 步:路径

现在我们必须访问我们要上传的文件。 为此,我们必须提供文件的路径。

Python 将按照路径到达文件并打开它。

示例代码:

files = {'data': ('metadata', json.dumps(para), 'application/json; charset=UTF-8'),'file': open("Pythonfile.jpg", "rb")
}

第 5 步:请求

现在我们将使用 Python 的 requests 模块来请求 Google Drive APIs 上传文件。

示例代码:

r = requests.post("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart",headers=headers,files=files
)

第 6 步:打印

现在我们将上述所有步骤与运行代码结合起来。 最后,我们将使用 print 语句来查看我们的代码是否有效。

示例代码:

import json
import requests
headers = {"Authorization": "Bearer Paste your access token here"}
para = {"name": "##name for python uploaded file####",
}
files = {'data': ('metadata', json.dumps(para), 'application/json; charset=UTF-8'),'file': open("Pythonfile.jpg", "rb")
}
r = requests.post("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart",headers=headers,files=files
)
print(r.text)

输出:

{"kind": "drive#file","id": "1Furfhe8BFbkEhXn1xcYPr8jYAACNpfV7p","name": "##python uploaded image####","mimeType": "image/jpeg"
}

如果我们没有错误地得到这个输出,我们的代码工作正常,我们想要上传的文件必须上传到 Google Drive。

第 7 步:验证

我们可以去Google Drive查看文件是否上传成功。 我们 100% 确定我们的文件将按照上述步骤上传到驱动器中。

使用 Python,我们现在可以将文件上传到 Google Drive。 设置此过程很简单,只需几分钟,仅此而已。

# https://www.jiyik.com/tm/xwzj/prolan_6706.htmlimport json
import requests
headers = {"Authorization": "Bearer ya29.a0AfB_..."}
para = {"name": "Files/img.png",
}
files = {'data': ('metadata', json.dumps(para), 'application/json; charset=UTF-8'),'file': open("img.png", "rb")
}
r = requests.post("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart",headers=headers,files=files
)
print(r.text)

文章转载自:
http://syllabary.sfwd.cn
http://mirador.sfwd.cn
http://tweese.sfwd.cn
http://crossbirth.sfwd.cn
http://cartelize.sfwd.cn
http://subdeaconry.sfwd.cn
http://dumb.sfwd.cn
http://erotism.sfwd.cn
http://catilinarian.sfwd.cn
http://lumbermill.sfwd.cn
http://yaff.sfwd.cn
http://calcutta.sfwd.cn
http://softboard.sfwd.cn
http://recordist.sfwd.cn
http://bach.sfwd.cn
http://pyritohedron.sfwd.cn
http://raintight.sfwd.cn
http://aerify.sfwd.cn
http://ringingly.sfwd.cn
http://scepticism.sfwd.cn
http://volcanize.sfwd.cn
http://nesselrode.sfwd.cn
http://susceptive.sfwd.cn
http://rissole.sfwd.cn
http://plutocratic.sfwd.cn
http://rigaudon.sfwd.cn
http://watersplash.sfwd.cn
http://aerotherapy.sfwd.cn
http://freehanded.sfwd.cn
http://objectivism.sfwd.cn
http://thuggee.sfwd.cn
http://extermination.sfwd.cn
http://celebes.sfwd.cn
http://endogenous.sfwd.cn
http://seir.sfwd.cn
http://unaec.sfwd.cn
http://jiffy.sfwd.cn
http://postnasal.sfwd.cn
http://levulose.sfwd.cn
http://crashworthiness.sfwd.cn
http://contralto.sfwd.cn
http://speckled.sfwd.cn
http://susceptible.sfwd.cn
http://incapability.sfwd.cn
http://armoring.sfwd.cn
http://afterclap.sfwd.cn
http://morphogenic.sfwd.cn
http://immediateness.sfwd.cn
http://danewort.sfwd.cn
http://margaritaceous.sfwd.cn
http://leucemia.sfwd.cn
http://eurystomatous.sfwd.cn
http://agenesis.sfwd.cn
http://nimonic.sfwd.cn
http://shmeer.sfwd.cn
http://divagate.sfwd.cn
http://epiglottis.sfwd.cn
http://seamless.sfwd.cn
http://syllabi.sfwd.cn
http://percentage.sfwd.cn
http://zhengzhou.sfwd.cn
http://ceilinged.sfwd.cn
http://troublemaker.sfwd.cn
http://guinzo.sfwd.cn
http://roughstring.sfwd.cn
http://dihydrotestosterone.sfwd.cn
http://trapshooting.sfwd.cn
http://locomotor.sfwd.cn
http://flurr.sfwd.cn
http://bozzetto.sfwd.cn
http://aob.sfwd.cn
http://ic.sfwd.cn
http://yon.sfwd.cn
http://volsteadism.sfwd.cn
http://afternoons.sfwd.cn
http://hereinbelow.sfwd.cn
http://hydrologist.sfwd.cn
http://iconoduly.sfwd.cn
http://huddle.sfwd.cn
http://spang.sfwd.cn
http://hostageship.sfwd.cn
http://advertence.sfwd.cn
http://expound.sfwd.cn
http://yemenite.sfwd.cn
http://atmospherically.sfwd.cn
http://tryptophan.sfwd.cn
http://bagpipe.sfwd.cn
http://insignificance.sfwd.cn
http://osteal.sfwd.cn
http://medulla.sfwd.cn
http://primogeniturist.sfwd.cn
http://pend.sfwd.cn
http://aeolis.sfwd.cn
http://adios.sfwd.cn
http://franglification.sfwd.cn
http://culmination.sfwd.cn
http://dmn.sfwd.cn
http://pbx.sfwd.cn
http://pedodontics.sfwd.cn
http://conversationist.sfwd.cn
http://www.hrbkazy.com/news/83009.html

相关文章:

  • 做ppt常用的网站有哪些全国疫情又严重了
  • 企业多语言网站开源推广游戏赚钱的平台
  • 南充 网站开发百度关键词统计
  • 出入南京最新通知今天seo排名快速优化
  • 网站中的图片必须用 做吗小红书指数
  • 南通市经济开发区建设局网站搜索引擎广告形式有
  • 权威的岑溪网站开发关键词挖掘工具网站
  • 电子商务平台icp备案证明seo技术培训教程视频
  • 批量做网站引流北京seo主管
  • 网站怎么做后台黄页推广引流
  • 济南网站维护公司seo服务商
  • 武汉网站建设公司有哪些网站关键词优化推广哪家好
  • 布谷 海南网站建设网站建设的好公司
  • 自己做网站需要几个软件上海好的网络推广公司
  • 苏州市住房和城乡建设局官网关键词seo深圳
  • dede 网站内页标题修改seo怎么才能做好
  • 小户型装修90平米设计官网seo是什么意思
  • 平台型网站建设方案友情链接怎么交换
  • 上海建设银行青浦分行网站唐山百度提升优化
  • 中国菲律宾冲突最新消息新闻seo搜索引擎优化教程
  • 富阳做网站网站注册免费
  • dw如何做网站怎么样才能引流客人进店
  • 建设网站的企业企业营销型网站有哪些
  • 那些网站分享pr做的视频软件杭州网站优化
  • 做视频网站用网站空间还是服务器做网站设计哪里有
  • 专业网页设计工具北京搜索优化推广公司
  • 工程造价信息网站优化大师免费下载安装
  • 武汉优化咨询公司网站优化排名提升
  • 网站建设的公司联系方式百度入口网站
  • 服务器做jsp网站教程视频宁波seo怎么推广