Wasser module is created for providing https requests for Python 2.6, where you don't have pyOpenSSL, cryptography. Instead this module uses ssl wrapped sockets
Class for representation of server response, and manipulating data in it
wasser.Response
head - headers of http response
body - body of http response
code - code of http response
date - date of http response
content_length - length of body
content_type - type of body
encoding - encoding of body
server - type of server, from which we get response
__init__(self, data)
Creating and parsing response on
- headers,
- body,
- code of response,
- date of response,
- content_length,
- content_type,
- encoding,
- server
Class to create https requests for Python 2.6
ca - path to your CA certificate for checking server certificate
user_cert - path to your certificate for connection
user_key - path to your key for connection
__init__(self, user_cert, user_key, ca)
For creating https request you need to provide path for your certificate and key
get(self, url)
GET request, provide fully qualified url
as example - https://localhost:1027/
not localhost:1027/
post(self, url, message)
POST request, provide url(as in get(self, url)
method) and message to post
if type of message is dict -> request Content-Type will be application/json, else request will post text/plain
from wasser import Wasser
request = Wasser('test.crt', 'test.key', 'CAtest.crt')
get_response = request.get('https://example.com/')
print get_response
text_message = 'Hello'
post_text_response = request.post('https://example.com/', text_message)
print post_text_responce
json_message = {'key':'value'}
post_json_response = request.post('https://example.com/', json_message)
print post_json_responce