Created
July 14, 2021 01:05
-
-
Save heyseus1/190b99b9f3a7bfe124fb6ab87417cbe1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import requests | |
import os | |
import json | |
import pandas as pd | |
client_id = os.environ['WAVEFRONT_APIKEY'] | |
class Events(): | |
def Main(self): | |
emails = [] | |
subdomain = input('enter sub-domain:' ) | |
url = f'https://{subdomain}.wavefront.com/api/v2/user' | |
response = requests.get(url, | |
headers={'Accept': 'application/json', | |
'authorization': 'Bearer '+ client_id}).json() | |
for item in response: | |
emails.append(item['identifier']) | |
d = {'Email': emails} | |
df = pd.DataFrame(data=d) | |
print(df) | |
df.to_csv("wavefront_userlist.csv", index=False) | |
if __name__ == "__main__": | |
Events().Main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment