slack importer: Get user data from a get request to slack users api.

The fresh imported data shows that the users emails are not included
in the data. However, the data received from the older method of slack
(which is using legacy tokens) contains the email data of the users.
This commit is contained in:
Rhea Parekh
2018-02-01 05:26:57 +05:30
committed by Tim Abbott
parent 6e30da9f92
commit c0e30079f6
3 changed files with 74 additions and 21 deletions

View File

@@ -21,6 +21,9 @@ class Command(BaseCommand):
parser.add_argument('realm_name', metavar='<realm_name>',
type=str, help="Realm Name")
parser.add_argument('--token', metavar='<slack_token>',
type=str, help='Slack legacy token of the organsation')
parser.add_argument('--output', dest='output_dir',
action="store", default=None,
help='Directory to write exported data to.')
@@ -37,14 +40,19 @@ class Command(BaseCommand):
os.makedirs(output_dir)
realm_name = options['realm_name']
token = options['token']
if realm_name is None:
print("Enter realm name!")
exit(1)
if token is None:
print("Enter slack legacy token!")
exit(1)
for path in options['slack_data_zip']:
if not os.path.exists(path):
print("Slack data directory not found: '%s'" % (path,))
exit(1)
print("Converting Data ...")
do_convert_data(path, realm_name, output_dir)
do_convert_data(path, realm_name, output_dir, token)