An internal function to be called in api-client when a websocket create is requested.
(connect_opt, configuration, url, headers)
| 549 | return websocket |
| 550 | |
| 551 | def websocket_proxycare(connect_opt, configuration, url, headers): |
| 552 | """ An internal function to be called in api-client when a websocket |
| 553 | create is requested. |
| 554 | """ |
| 555 | if configuration.no_proxy: |
| 556 | connect_opt.update({ 'http_no_proxy': configuration.no_proxy.split(',') }) |
| 557 | |
| 558 | if configuration.proxy: |
| 559 | proxy_url = urlparse(configuration.proxy) |
| 560 | connect_opt.update({'http_proxy_host': proxy_url.hostname, 'http_proxy_port': proxy_url.port}) |
| 561 | if configuration.proxy_headers: |
| 562 | for key,value in configuration.proxy_headers.items(): |
| 563 | if key == 'proxy-authorization' and value.startswith('Basic'): |
| 564 | b64value = value.split()[1] |
| 565 | auth = urlsafe_b64decode(b64value).decode().split(':') |
| 566 | connect_opt.update({'http_proxy_auth': (auth[0], auth[1]) }) |
| 567 | return(connect_opt) |
| 568 | |
| 569 | |
| 570 | def websocket_call(configuration, _method, url, **kwargs): |