8000 Merge pull request #371 from plotly/sync_subs · s-celles/plotly.py@030804e · GitHub
[go: up one dir, main page]

Skip to content

Commit 030804e

Browse files
committed
Merge pull request plotly#371 from plotly/sync_subs
sync chunked requests proxy updates
2 parents 20102d6 + e1f30ca commit 030804e

File tree

3 files changed

+26
-12
lines changed
  • plotly
    • graph_reference
  • plotly/chunked_requests
  • submodules
  • 3 files changed

    +26
    -12
    lines changed

    plotly/graph_reference/default-schema.json

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -7017,7 +7017,7 @@
    70177017
    "valType": "string"
    70187018
    }
    70197019
    },
    7020-
    "description": "The data that describes the heatmap value-to-color mapping is set in `z`. Data in `z` can either be a {2D array} of values (ragged or not) or a 1D array of values. In the case where `z` is a {2D array}, say that `z` has N rows and M columns. Then, by default, the resulting heatmap will have N partitions along the y axis and M partitions along the x axis. In other words, the i-th row/ j-th column cell in `z` is mapped to the i-th partition of the y axis (starting from the bottom of the plot) and the j-th partition of the x-axis (starting from the left of the plot). This behavior can be flipped by using `transpose`. Moreover, `x` (`y`) can be provided with M or M+1 (N or N+1) elements If M (N), then the coordinates correspond to the center of the heatmap cells and the cells have equal width. If M+1 (N+1), then the coordinates correspond to the edges of the heatmap cells. In the case where `z` is a 1D {array}, the x and y coordinates must be provided in `x` and `y` respectively to form data triplets."
    7020+
    "description": "The data that describes the heatmap value-to-color mapping is set in `z`. Data in `z` can either be a {2D array} of values (ragged or not) or a 1D array of values. In the case where `z` is a {2D array}, say that `z` has N rows and M columns. Then, by default, the resulting heatmap will have N partitions along the y axis and M partitions along the x axis. In other words, the i-th row/ j-th column cell in `z` is mapped to the i-th partition of the y axis (starting from the bottom of the plot) and the j-th partition of the x-axis (starting from the left of the plot). This behavior can be flipped by using `transpose`. Moreover, `x` (`y`) can be provided with M or M+1 (N or N+1) elements. If M (N), then the coordinates correspond to the center of the heatmap cells and the cells have equal width. If M+1 (N+1), then the coordinates correspond to the edges of the heatmap cells. In the case where `z` is a 1D {array}, the x and y coordinates must be provided in `x` and `y` respectively to form data triplets."
    70217021
    },
    70227022
    "histogram": {
    70237023
    "attributes": {

    plotly/plotly/chunked_requests/chunked_request.py

    Lines changed: 24 additions & 10 deletions
    Original file line numberDiff line numberDiff line change
    @@ -70,24 +70,38 @@ def write(self, data, reconnect_on=('', 200, )):
    7070
    self._reconnect()
    7171
    self.write(data)
    7272

    73+
    def _get_proxy_config(self):
    74+
    """
    75+
    Determine if self._url should be passed through a proxy. If so, return
    76+
    the appropriate proxy_server and proxy_port
    77+
    78+
    """
    79+
    80+
    proxy_server = None
    81+
    proxy_port = None
    82+
    83+
    ## only doing HTTPConnection, so only use http_proxy
    84+
    proxy = os.environ.get("http_proxy")
    85+
    no_proxy = os.environ.get("no_proxy")
    86+
    no_proxy_url = no_proxy and self._url in no_proxy
    87+
    88+
    if proxy and not no_proxy_url:
    89+
    p = urlparse(proxy)
    90+
    proxy_server = p.hostname
    91+
    proxy_port = p.port
    92+
    93+
    return proxy_server, proxy_port
    94+
    7395
    def _connect(self):
    7496
    ''' Initialize an HTTP connection with chunked Transfer-Encoding
    7597
    to server:port with optional headers.
    7698
    '''
    7799
    server = self._server
    78100
    port = self._port
    79101
    headers = self._headers
    102+
    proxy_server, proxy_port = self._get_proxy_config()
    80103

    81-
    ## only doing HTTPConnection, so only use http_proxy
    82-
    proxy = os.environ.get("http_proxy");
    83-
    proxy_server = None
    84-
    proxy_port = None
    85-
    if (proxy != None):
    86-
    p = urlparse(proxy)
    87-
    proxy_server = p.hostname
    88-
    proxy_port = p.port
    89-
    90-
    if (proxy_server != None and proxy_port != None):
    104+
    if (proxy_server and proxy_port):
    91105
    self._conn = http_client.HTTPConnection(proxy_server, proxy_port)
    92106
    self._conn.set_tunnel(server, port)
    93107
    else:

    0 commit comments

    Comments
     (0)
    0