Comments (1)
Probably httplib2
/http
have some issue. I tried to run row requests with httplib2
and request
,
and variant with request
always return success,
httplib2
always failed.
import json
import logging
import coloredlogs
coloredlogs.install(logging.DEBUG)
HOST = 'rabbitmq'
PORT = '15672'
USER = 'admin'
PASSW = 'admin'
VHOST = 'some'
DATA = json.dumps({"configure": '.*', "read": '.*', "write": '.*'})
HEADERS = {"Content-Type": "application/json"}
URL = 'http://192.168.155.128:15672/api/permissions/some/admin'
def request():
import requests
requests.put(URL, auth=(USER, PASSW), data=DATA, headers=HEADERS)
request()
def http():
import httplib2
client = httplib2.Http()
client.add_credentials(USER, PASSW)
client.request(URL, "PUT", DATA, headers=HEADERS)
http()
httplib2
traceback:
Traceback (most recent call last):
File "./tmp.py", line 31, in <module>
http()
File "./tmp.py", line 30, in http
client.request(URL, "PUT", DATA, headers=HEADERS)
File "/usr/local/lib/python3.5/site-packages/httplib2/__init__.py", line 1314, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/usr/local/lib/python3.5/site-packages/httplib2/__init__.py", line 1075, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers, )
File "/usr/local/lib/python3.5/site-packages/httplib2/__init__.py", line 988, in _conn_request
conn.request(method, request_uri, body, headers)
File "/usr/local/lib/python3.5/http/client.py", line 1083, in request
self._send_request(method, url, body, headers)
File "/usr/local/lib/python3.5/http/client.py", line 1128, in _send_request
self.endheaders(body)
File "/usr/local/lib/python3.5/http/client.py", line 1079, in endheaders
self._send_output(message_body)
File "/usr/local/lib/python3.5/http/client.py", line 913, in _send_output
self.send(message_body)
File "/usr/local/lib/python3.5/http/client.py", line 885, in send
self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe
Any idea? :)
from pyrabbit.
Related Issues (20)
- Deleting binding does not work if routing-key contains hash HOT 1
- Printing api URL disturbs target application HOT 9
- Thread safety
- Unable to access RabbitMQ server over HTTPS connection HOT 1
- Rights management doesn't work well with vhosts HOT 1
- print in http HOT 2
- New release HOT 7
- set_vhost_permissions raises NetworkError HOT 2
- add get_node (node details)
- Breaking change?
- Can't connect, whoami fails? HOT 1
- Work with shovel plugin HOT 1
- API does not have exchange to exchange binding HOT 9
- documentation error: httplib2.ServerNotFoundError: Unable to find the server at http HOT 2
- pip not updated to latest commit HOT 1
- get_queue_depths prints lengths instead of returning them
- License on https://pypi.org/project/pyrabbit/ wrong
- Makes get queue size supports return only needed columns
- get_messages now requires 'ackmode' on request 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 pyrabbit.