allow custom HTTP headers (e.g. bearer token) to Mapbox layer source
未关闭
还没有人认领这个 Issue。
feature
P3
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
Hi!
I wanted to display a Mapbox layer that requires authentication through bearer tokens, i.e. when doing something like:
fig.update_layout(
mapbox_style="white-bg",
mapbox_layers=[
{
"below": 'traces',
"sourcetype": "raster",
"sourceattribution": "My private ortho",
"source": [
"https://my_private_source.com/MapServer/tile/{z}/{y}/{x}"
]
}
]
)
I need to pass custom HTTP headers to each tile request. In JavaScript, this can be easily achieved with the Mapbox API thanks to transformRequest (see here):
const map = new mapboxgl.Map({
container: 'map',
center: [2.35, 48.86],
zoom: 13,
transformRequest: (url, resourceType) => {
if (url.startsWith('https://my_private_source.com')) {
return {
url: url,
headers: { 'Authorization': 'Bearer ' + my_private_token }
}
}
}
});
However, this does not seem supported by plotly.py, or am I missing something? With some pointers I could work on a PR, but I'm not sure where to start in the code base.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该 issue 没有指定文件或测试。首先跟踪 plotly.py 如何序列化 mapbox_layers,以及 JavaScript 地图如何请求栅格瓦片,然后将这条路径与链接的 transformRequest 示例进行比较。当可以为每个 Mapbox 图层瓦片请求提供自定义 header,并且该行为由适当的测试覆盖时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, python
- 领域
- frontend, web-dev
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100