This repository has been archived by the owner on May 15, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from cliffordwhansen/master
A couple of new settings
- Loading branch information
Showing
16 changed files
with
117 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.pyo | ||
*.pyo | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
|
||
import os, sys | ||
import time, socket | ||
import urllib | ||
import thread | ||
import threading | ||
|
||
try: | ||
# Python 3.0 + | ||
import http.client as httplib | ||
except ImportError: | ||
# Python 2.7 and earlier | ||
import httplib | ||
|
||
try: | ||
# Python 2.6 + | ||
from hashlib import sha as sha | ||
except ImportError: | ||
# Python 2.5 and earlier | ||
import sha | ||
|
||
__author__ = "Ralph-Gordon Paul, Adrian Cowan" | ||
__credits__ = ["Ralph-Gordon Paul", "Adrian Cowan", "Justin Nemeth", "Sean Rudford"] | ||
__license__ = "GPL" | ||
__maintainer__ = "Ralph-Gordon Paul" | ||
__email__ = "ralph-gordon.paul@uni-duesseldorf.de" | ||
__status__ = "Production" | ||
|
||
# Allows non-blocking http requests | ||
class NBHTTPSConnection(): | ||
def __init__(self, host, port = None, strict = None, timeout = None): | ||
self.rawConnection = httplib.HTTPSConnection(host, port, strict, timeout) | ||
self.responce = None | ||
self.responceLock = threading.Lock() | ||
self.closing = False | ||
|
||
def request(self, method, url, body = None, headers = {}): | ||
self.rawConnection.request(method, url, body, headers); | ||
|
||
def hasResult(self): | ||
if self.responceLock.acquire(False): | ||
self.responceLock.release() | ||
return True | ||
else: | ||
return False | ||
|
||
def getResult(self): | ||
while not self.hasResult() and not self.closing: | ||
time.sleep(1) | ||
return self.responce | ||
|
||
def go(self): | ||
self.responceLock.acquire() | ||
thread.start_new_thread ( NBHTTPSConnection._run, ( self, ) ) | ||
|
||
def _run(self): | ||
self.responce = self.rawConnection.getresponse() | ||
self.responceLock.release() | ||
|
||
def close(self): | ||
self.closing = True | ||
self.rawConnection.close() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters