plotly / plotly/plotly.py

mapbox static image export fails with tile server requiring client certificates

Offen
#3,339 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P3
Vorherrschende Sprache
Python
Sterne
18.8k
Forks
2.8k
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
21

Beschreibung

Hello,
I am using plotly.py on an internal network which does not have Internet connectivity. All connections on this network require client certificates, all servers have signed certificates for which we have a Certificate Authority bundle to verify those certificates.

I can create mapbox maps in our Jupyter environment which render appropriately, but when I try to export the map as an image using Kaleido I receive a chain of errors, concluding with error: ValueError: Transform failed with error code 525: Mapbox error. which references kaleido/scopes/plotly.py (here)

The HTTP 525 code is "SSL Handshake Failure". I'm using a 'white-bg' mapbox style and have confirmed no requests are going out looking for a mapbox server. When I remove the map tiles from the chart figure I can successfully export the map as a static image. Digging through the plotly code, it looks like the Kaleido base scope (here) is using chromium to render the map and then save it as an image.

The issue is that when I render the map in my browser, the browser has my client certificates loaded and the CA bundle loaded and it brings in the image tiles. When Plotly/Kaleido tries to retrieve the tiles using the underlying headless chromium, it's using a bare GET request and is being denied by the server (HTTP 525).

I've spent a lot of time looking for flags that could be passed to chromium to tell it to use my client certificates and the CA bundle, but (VERY surprisingly) there do not appear to be any.

A reproducible example is exactly like the Mapbox Map Layers - Base Tiles from the USGS: no token needed example, except that the server would require client certificates and could be verified with a custom CA bundle.

I would happily use a work-around if one was possible. Thanks!

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den Fehler beim statischen Mapbox-Export anhand des verknüpften USGS-base-tiles-Beispiels in einem Netzwerk zu reproduzieren, das Client-Zertifikate erfordert. Lies kaleido/scopes/plotly.py und kaleido/scopes/base.py und ermittle anschließend, was Headless Chromium ermöglichen würde, die Tiles mit dem Client-Zertifikat und dem CA-Bundle zu laden; abgeschlossen ist die Aufgabe, wenn das Diagramm mit diesen Tiles erfolgreich exportiert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.