コード例 #1
0
ファイル: base.py プロジェクト: abcfdn/Octopus-deprecated
 def load_task_common_config(self):
     config_file = os.path.join(
         TASK_CONFIG_ROOT_PATH, self.app_name(), 'common.yaml')
     if os.path.isfile(config_file):
         return util.load_yaml(config_file)
     else:
         return {}
コード例 #2
0
ファイル: base.py プロジェクト: abcfdn/Octopus-deprecated
 def load_config(self):
     common_config = util.deepmerge(
         self.load_common_config(), self.load_task_common_config())
     task_config = util.load_yaml(os.path.join(
         TASK_CONFIG_ROOT_PATH,
         self.app_name(),
         '{}.yaml'.format(self.__class__.__name__)))
     return util.deepmerge(task_config, common_config)
コード例 #3
0
    def __init__(self, google_creds, mongo_config):
        self.config = util.load_yaml(CONFIG_PATH)

        self.sheet_service = GoogleSheet(google_creds)
        self.load_events()
        self.load_schedules()

        conn = MongoConnection(mongo_config)
        self.session_store = SessionStore(conn)
        self.presenter_store = PresenterStore(conn)
コード例 #4
0
def get_member_info():
    config = util.load_yaml(COMMON_CONFIG_PATH)
    conn = MongoConnection(config['mongo'])
    store = MemberStore(conn)
    members = store.find_all({}, max_cnt=1000)
    with open('/root/members.csv', 'w') as f:
        fieldnames = ['name', 'email', 'card']
        writer = csv.DictWriter(f, delimiter=',', fieldnames=fieldnames)
        writer.writeheader()
        for member in members:
            row = {
                'name': member.get('name', ''),
                'email': member.get('email', ''),
                'card': member.get('membership_card', {}).get('baseUrl', '')
            }
            writer.writerow(row)
コード例 #5
0
ファイル: base.py プロジェクト: abcfdn/Octopus-deprecated
 def load_common_config(self):
     common_config_file = os.path.join(CONFIG_ROOT_PATH, 'common.yaml')
     return util.load_yaml(common_config_file)
コード例 #6
0
def member_card_test():
    config = util.load_yaml(COMMON_CONFIG_PATH)
    imgur = Imgur(config['imgur']['creds_file'])
    photos = imgur.get_photos('TTA1Bp4')
    imgur.upload_photos(photos, 'XaBxokL')
    pprint(photos[0].__dict__)
コード例 #7
0
def member_sync():
    config = util.load_yaml(COMMON_CONFIG_PATH)
    MemberSync(google_creds(config), config['imgur'], config['mongo']).sync_membership_card()
コード例 #8
0
def event_poster():
    config = util.load_yaml(COMMON_CONFIG_PATH)
    WhitepaperJournalEventPoster(google_creds(config)).process(1550875924)
コード例 #9
0
def test_photo():
    config = util.load_yaml(COMMON_CONFIG_PATH)
    service = GooglePhoto(config['google'])
    filepath = "/tmp/abc_apps/whitepaper_journal/event_poster/output/blockspace_20190215.jpg"
    service.create_item(POST_ALBUM_ID, filepath, "poster for test")
コード例 #10
0
def test_mongo():
    config = util.load_yaml(CONFIG_PATH)
    common_config = util.load_yaml(COMMON_CONFIG_PATH)
    config.update(common_config)
    service = Service(config['mongo'])
    print(service.get_recent_sessions())
コード例 #11
0
def config():
    config = util.load_yaml(CONFIG_PATH)
    common_config = util.load_yaml(COMMON_CONFIG_PATH)
    config.update(common_config)
    return config
コード例 #12
0
ファイル: meetup.py プロジェクト: abcfdn/Octopus-deprecated
 def get_api_key(self):
     meetup_config = util.load_yaml(self.config['meetup']['api_key'])
     return meetup_config['api_key']