コード例 #1
0
 def __init__(self, user_id, page=1, session=None, logger=None):
     # logger設定
     if logger is None:
         logger = logging.getLoger(__name__)
     # 値設定
     self._user_id = user_id
     self._page_number = page
     # 接続
     url = r'http://togetter.com/id/{0}'.format(user_id)
     params = {'page': page} if page != 1 else {}
     if session is None:
         session = requests.session()
     self._session = session
     WebPage.__init__(self, url,
                      params=params,
                      session=self._session,
                      logger=logger)
     # logger出力
     self._logger.info('{0}'.format(self.__class__.__name__))
     self._logger.info('  user id: {0}'.format(self._user_id))
     self._logger.info('  page   : {0}'.format(self._page_number))
     self._logger.info('  URL    : {0}'.format(self.url))
コード例 #2
0
ファイル: logger.py プロジェクト: emeehl/Termofluxometro
#!/usr/bin/python3.4
# -*- coding: utf-8 -*-


import logging, datetime, time

LOG_FILENAME = '/tmp/transmitancia.log'
LOG_LEVEL = logging.INFO

#Crear o logger e conectarse a el
logger = logging.getLoger('Termoflux')
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s: %(name)s - %(message)s', \
                datefmt = '%Y%m%d %H:%M:%S')

#Crear manipulador do logging, formato, etc
fh = logging.StreamHandler(LOG_FILENAME)
fh.setLevel(LOG_LEVEL)
fh.setFormatter(formatter)

#Conectar o manipulador co logger
logger.addHandler(fh)



コード例 #3
0
    def __init__(self):

        super(BaseModel, self).__init__()
        self.logger = logging.getLoger(self.__class__.__name__)
コード例 #4
0
"""


import os
import shutil
import html.parser
import json
import traceback
import sys
import time
import io
import tokenize
import token
import logging

logger = logging.getLoger(__name__)

# Template for application setup.py script
setup = """from setuptools import setup, find_packages

import os

if os.path.exists('README.rst'):
    with open('README.rst', encoding='utf-8') as fobj:
        LONG_DESCRIPTION = fobj.read()

setup(
    name='{app_name}',
    version='{version}',

    # The project's main homepage.
コード例 #5
0
ファイル: excel_control.py プロジェクト: PyBack/AutoExcelData
# -*- coding: utf-8 -*-

import logging
import win32com.client as win32com_client

excel = win32com_client.gencache.EnsureDispatch('Excel.Application')
logger = logging.getLoger('AutoReport.ExcelControl')


def insert_row(excel_file_name='', sheet_name='', range_cell_row=1):
    wb = None
    for i in range(1, excel.Workbooks.Count + 1):
        if excel.Workbooks.Item(i).Name == excel_file_name:
            wb = excel.Workbooks.Item(i)
            break
        if wb is None:
            logger.error('insert row-> no opened excel file %s' % excel_file_name)
            return
        
        logger.info('insert row-> catch %s file...' % wb.Name)
        
        wb.Activate()
        ws = wb.Worksheets(sheet_name)
        ws.Select()
        excel.Visible = Trueif
        
        rng = ws.Range("%d:%d" %(range_cell_row, range_cell_row))
        rng.Select()
        rng.Insert()
        excel.Visible = True
        pass
コード例 #6
0
ファイル: arches_client.py プロジェクト: nedmarinov/Bismuth
from base64 import b64encode
import hashlib
import logging
import sqlite3
import time
import keys
import psutil
import pyping
import socket

from Cryptodome.Signature import PKCS1_v1_5 as PKCS
from Cryptodome.Hash import SHA

app_log = logging.getLoger("arches.log")


def sign_transaction(transaction, key):
    h = SHA.new(str(transaction))
    signer = PKCS.new(key)
    signature = signer.sign(h)
    encoded_signature = b64encode(signature)
    return signature, encoded_signature


def tx_to_mempool(timestamp, address, encoded_signature, pub_key_hash,
                  openfield):
    cursor = None
    try:
        mempool = sqlite3.connect("mempool.db")
        mempool.text_factory = str
        cursor = mempool.cursor()
コード例 #7
0
ファイル: mainLogServer.py プロジェクト: ketwang/saltstack
	def loggerBindSocketfd(self):
		self.logger = logging.getLoger()
		self.logger.setLevel(logging.DEBUG)
                formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
                self.logger.setFormatter(formatter)
                self.logger.addHandler(fd)
コード例 #8
0
ファイル: mainLogServer.py プロジェクト: ketwang/saltstack
	def __init__(obejct):
		if not logserver:
			raise ValueError, 'log server does not exists!'
		self.logger = logging.getLoger()
		self.connectionToUnixDoaminServer()