command to export oauth credentials

This commit is contained in:
Jonathan Eads 2014-01-31 18:25:34 -08:00
Родитель abd2c37bef
Коммит ec56c5c511
1 изменённых файлов: 30 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,30 @@
import os
import json
from django.core.management.base import BaseCommand
from treeherder.model.models import Datasource
from treeherder.model.derived.base import TreeherderModelBase
from treeherder.etl import buildapi
class Command(BaseCommand):
"""Management command to run mozilla pulse consumer."""
help = (
"Exports the objectstore Oauth keys for etl data import tasks"
)
def handle(self, *args, **options):
immutable_credentials = TreeherderModelBase.get_oauth_credentials()
file_path = os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
'data',
'credentials.json'
)
keys_fh = open(file_path, 'w')
keys_fh.write(json.dumps(immutable_credentials))
keys_fh.close()