Comments (5)
pylxd isn't collecting any proxy information (presumably because requests
usually Just Works). This is probably a bug in requests_unixsocket
, but since it affects pylxd, it's worth our time to try and track it down.
from pylxd.
Looks like the behaviour was introduced relatively recently, after requests 2.9.1 and requests-unixsocket 0.1.5 (as shipped in Ubuntu 16.04).
from __future__ import print_function
import os
import sys
import pkg_resources
import requests
import requests_unixsocket
SOCKET_URL = 'http+unix://%2Fvar%2Flib%2Flxd%2Funix.socket'
print('HTTP_PROXY:', os.environ['HTTP_PROXY'])
print('sys.version:', sys.version.replace('\n', ' '))
print('requests.__version__', requests.__version__)
print('requests_unixsocket versions', pkg_resources.get_distribution('requests_unixsocket').version)
unixsocket_session = requests_unixsocket.Session()
print('unixsocket_session.get:', unixsocket_session.get(SOCKET_URL))
requests_unixsocket.monkeypatch()
print('requests.get:', requests.get(SOCKET_URL))
alex@martha:/tmp$ HTTP_PROXY=foo python foo.py
HTTP_PROXY: foo
sys.version: 2.7.11+ (default, Apr 17 2016, 14:00:29) [GCC 5.3.1 20160413]
requests.__version__ 2.9.1
requests_unixsocket versions 0.1.5
unixsocket_session.get: <Response [200]>
requests.get: <Response [200]>
from pylxd.
The latest released versions (requests 2.10.0, requests-unixsocket 0.1.5) do not trigger the behaviour
alex@martha:/tmp$ virtualenv v
Running virtualenv with interpreter /usr/bin/python2
New python executable in /tmp/v/bin/python2
Also creating executable in /tmp/v/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
alex@martha:/tmp$ v/bin/pip install requests requests_unixsocket
Collecting requests
Using cached requests-2.10.0-py2.py3-none-any.whl
Collecting requests_unixsocket
Downloading requests-unixsocket-0.1.5.tar.gz
Collecting urllib3>=1.8 (from requests_unixsocket)
Using cached urllib3-1.16-py2.py3-none-any.whl
Building wheels for collected packages: requests-unixsocket
Running setup.py bdist_wheel for requests-unixsocket ... done
Stored in directory: /home/alex/.cache/pip/wheels/fa/a2/48/cd582e716aa8699b605b6976914744a46b8e8e17a9974380f9
Successfully built requests-unixsocket
Installing collected packages: requests, urllib3, requests-unixsocket
Successfully installed requests-2.10.0 requests-unixsocket-0.1.5 urllib3-1.16
alex@martha:/tmp$ HTTP_PROXY=http://localhost v/bin/python foo.py
HTTP_PROXY: http://localhost
sys.version: 2.7.11+ (default, Apr 17 2016, 14:00:29) [GCC 5.3.1 20160413]
requests.__version__ 2.10.0
requests_unixsocket versions 0.1.5
unixsocket_session.get: <Response [200]>
requests.get: <Response [200]>
from pylxd.
Installing pylxd 2.0.2 downgrades from requests-unixsocket 0.1.5 to 0.1.4. Now this bug is triggered
alex@martha:/tmp$ v/bin/pip install pylxd
Collecting pylxd
Collecting ws4py>=0.3.4 (from pylxd)
Using cached ws4py-0.3.5-py2-none-any.whl
Collecting pbr>=1.6 (from pylxd)
Using cached pbr-1.10.0-py2.py3-none-any.whl
Collecting requests-unixsocket==0.1.4 (from pylxd)
Requirement already satisfied (use --upgrade to upgrade): requests!=2.8.0,>=2.5.2 in ./v/lib/python2.7/site-packages (from pylxd)
Collecting python-dateutil>=2.4.2 (from pylxd)
Using cached python_dateutil-2.5.3-py2.py3-none-any.whl
Collecting six>=1.9.0 (from pylxd)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: ws4py, pbr, requests-unixsocket, six, python-dateutil, pylxd
Found existing installation: requests-unixsocket 0.1.5
Uninstalling requests-unixsocket-0.1.5:
Successfully uninstalled requests-unixsocket-0.1.5
Successfully installed pbr-1.10.0 pylxd-2.0.2 python-dateutil-2.5.3 requests-unixsocket-0.1.4 six-1.10.0 ws4py-0.3.5
alex@martha:/tmp$ HTTP_PROXY=http://localhost v/bin/python foo.py
HTTP_PROXY: http://localhost
sys.version: 2.7.11+ (default, Apr 17 2016, 14:00:29) [GCC 5.3.1 20160413]
requests.__version__ 2.10.0
requests_unixsocket version 0.1.4
Traceback (most recent call last):
File "foo.py", line 18, in <module>
print('unixsocket_session.get:', unixsocket_session.get(SOCKET_URL))
File "/tmp/v/local/lib/python2.7/site-packages/requests/sessions.py", line 487, in get
return self.request('GET', url, **kwargs)
File "/tmp/v/local/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/tmp/v/local/lib/python2.7/site-packages/requests/sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "/tmp/v/local/lib/python2.7/site-packages/requests/adapters.py", line 370, in send
conn = self.get_connection(request.url, proxies)
File "/tmp/v/local/lib/python2.7/site-packages/requests_unixsocket/adapters.py", line 53, in get_connection
% self.__class__.__name__)
ValueError: UnixAdapter does not support specifying proxies
from pylxd.
It was fixed in python-unixsocket by msabramo/requests-unixsocket@20f4324, merged in msabramo/requests-unixsocket#14. I'll submit a PR to update the dependency.
from pylxd.
Related Issues (20)
- Remove lxd.tar.xz from history
- Are there any plans to support simplestream in pylxd
- Type of storage volume is always custom
- Latest release 2.3.0 or 2.3.1 HOT 1
- Client(verify=False) is not respected HOT 1
- migration: "instances" entry already exists HOT 1
- Lxc copy for clone lxc non exsiste in pylxd HOT 1
- Support managing network forwards HOT 1
- container.execute Failed to receive data ConnectionResetError: [Errno 104] Connection reset by peer ws4py/websocket.py HOT 1
- Replace ws4py with something which is maintained
- Connection refused error when using UNIX socket HOT 2
- pylxd version conflicts HOT 3
- Instability with executing commands and file operations in LXD virtual machine. HOT 2
- Please capture/return lxd container error logs within stack traces HOT 1
- Network ACLs management HOT 1
- Rename functionalities does not actually rename but create a new object instead
- Instance status and state().status out of sync
- Unable to pass recursion to client.instances.all()
- recursive_get doesn't preserve permissions HOT 1
- Can't set or update profile description HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylxd.