Code Monkey home page Code Monkey logo

wasser's Introduction

Module wasser

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

Classes

Response

Class for representation of server response, and manipulating data in it

Ancestors (in MRO)

wasser.Response

Instance variables

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

Methods

__init__(self, data)

Creating and parsing response on

  • headers,
  • body,
  • code of response,
  • date of response,
  • content_length,
  • content_type,
  • encoding,
  • server

Wasser

Class to create https requests for Python 2.6

Instance variables

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

Methods

__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

Example of usage

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

wasser's People

Contributors

ptakha avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.