From 7304f04c6ff7d94fc77bd2aa58c74e8e54d5ca47 Mon Sep 17 00:00:00 2001 From: Christian Jacobs Date: Sun, 24 Mar 2013 23:30:19 +0000 Subject: [PATCH] Added a function to initiate a session with the qrz.com server. --- src/callsign_lookup.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/callsign_lookup.py b/src/callsign_lookup.py index 6cea832..8e7d3f7 100644 --- a/src/callsign_lookup.py +++ b/src/callsign_lookup.py @@ -20,7 +20,20 @@ from gi.repository import Gtk, GObject import logging +import httplib # Uses qrz.com to lookup details about a particular callsign. +def init_session(username, password): + ''' Initiates a session with the qrz.com server. Hopefully this will return a session ID. ''' + connection = httplib.HTTPSConnection('xmldata.qrz.com', port=443) + request = '/xml/current/?username=%s;password=%s;agent=pyqso' % (username, password) + connection.request('GET', request) + response = connection.getresponse() + data = response.read() + + if(successful): + return session_id + else: + return None