Promoted pypo to top level because it isnt 3rd party.

Removed the portage stuff since it is way outdated.
This commit is contained in:
Paul Baranowski 2010-12-02 15:30:40 -05:00
parent 4300fd8d36
commit 51a1fde9ee
82 changed files with 0 additions and 6013 deletions

90
pypo/dls/dls_client.py Executable file
View file

@ -0,0 +1,90 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author Jonas Ohrstrom <jonas@digris.ch>
import sys
import time
import logging
from util import json
import os
import socket
class DlsClient():
def __init__(self, dls_host, dls_port, dls_user, dls_pass):
self.dls_host = dls_host
self.dls_port = dls_port
self.dls_user = dls_user
self.dls_pass = dls_pass
def set_txt(self, txt):
logger = logging.getLogger("DlsClient.set_txt")
try:
print 'trying to update dls'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.dls_host, self.dls_port))
s.send('client_zzzz')
s.send("\r\n")
data = s.recv(1024)
print data;
s.send('RS_DLS_VERSION' + ' ' + '1')
s.send("\r\n")
data = s.recv(1024)
print data;
s.send('SERVICE' + ' ' + self.dls_user)
s.send("\r\n")
s.send('PASSWORD' + ' ' + self.dls_pass)
s.send("\r\n")
data = s.recv(1024)
print data;
s.send('SET_DLS_CHARSET' + ' ' + '4')
s.send("\r\n")
data = s.recv(1024)
print data;
s.send('CLEAR_DLS')
s.send("\r\n")
s.send('SET_DLS' + ' ' + txt)
s.send("\r\n")
data = s.recv(1024)
print data;
s.send('CLOSE_DLS')
s.send("\r\n")
data = s.recv(1024)
print data;
s.close()
print 'OK'
except Exception, e:
#print e
print 'did not work out.'
dls_status = False
logger.info("Unable to connect to the update metadata - %s", e)
return