我想使用python检索我的个人资料图片,并将其显示在profiles.html上。
“...gif;base64,(variable)”alt=“profile”>?
我相信我需要改变(变量)响应,但我在转换它和我应该转换它到什么方面有困难。
以下是我尝试过的:
profiles.html:
{% extends "tutorial/layout.html" %}
{% block content %}
<h1>Profile</h1>
<img id="test" src="data:image/gif;base64,{{output_image}}" alt="profile">
{% endblock %}
graph_helper.py
def get_profiles(token):
graph_client = OAuth2Session(token=token)
profiles = graph_client.get(f"{graph_url}/me/photo/$value", stream=True)
return profiles.raw.read()
def profiles(request):
token = get_token(request)
profiles = get_profiles(token)
return render(request, 'tutorial/profiles.html', {"output_image": profiles})
此网站不能在以下数据处恢复网页:image/gif;base64,“,#\X1C\X1C(7),01444\X1F'9=82<.342\XFF\XDB\X00C\X01\T\T\X0C\X0B\X0C\X18\R\R\X182!\X1C!
def get_profiles(token):
graph_client = OAuth2Session(token=token)
query_params = {
"accept-encoding": "gzip, deflate"
}
photo_response = graph_client.get(f"{graph_url}/me/photo/$value", stream=True)
photo_status_code = photo_response.status_code
if photo_response.ok:
photo = photo_response.raw.read()
test = base64.b64encode(photo).decode('utf-8')
# note we remove /$value from endpoint to get metadata endpoint
metadata_response = graph_client.get(f"{graph_url}/me/photo/")
content_type = metadata_response.json().get('@odata.mediaContentType', '')
else:
photo = ''
content_type = ''
return test
在profiles.html中
<img class="profile_pic" src="data:image/png;base64,{{output_image}}" alt="___" style="width:50%">
我正在尝试这样做: https://developers.google.com/identity/sign-in/web/backend-auth#calling-the-tokeninfo-endpoint 我用CLIENT_ID复制了粘贴的Java代码,但是除了用户标识、电子邮件和电子邮件验证之外,我无法获得任何更多的信息。idTokenString验证确定。还有其他人可以这样做吗? 我要求这
在程序入口文件index.js 中可以在init方法中获取server对象,通过该server可以获取config,具体方式如下: init(server, options) { const config = server.config(); const url = config.get('elasticsearch.url'); } 自定义配置 1.配置校验与默
配置文件分为用户级配置和项目级配置。 用户级配置包含用户的环境及 UI 相关的选项,包括: 用户选项 中的所有内容。 扩展工具,包括已配置的扩展列表。 其他工具中的UI相关选项,例如 Target 组件下 站点地图 的选定视图。 项目级配置包含在特定目标应用程序上执行的工作相关的选项,包括: 项目选项中的所有内容。 单个Burp工具中的非UI相关选项,例如 代理 (Proxy) 和 扫描器 (Sc
我刚刚将我们的Spring Boot项目从引导升级到v2.6.2,从Spring Cloud升级到2021.0.0。 现在,我的远程配置获取没有任何效果,应用程序也无法获取正确的属性文件 [main]INFO o. s. c. c. c. ConfigServiceProperty tySourceLocator-从服务器获取配置:http://localhost:8080 [main]WARN
是否有一种方法可以将“配置客户机”和访问文件定义为configClient.getResource(),而不是从url获取
我的代码目录中有一个名为.env的文件.env有不同的配置 在我的代码目录中,我有一个名为脚本的文件夹 在脚本中,我有一个名为“control.py”的脚本,需要从.env读取配置 我如何才能做到这一点? 结构如下 。env有所有的配置文件,control.py需要读取这些配置文件。