Skip to content

Instantly share code, notes, and snippets.

@heyseus1
Created July 14, 2021 01:05
Show Gist options
  • Save heyseus1/190b99b9f3a7bfe124fb6ab87417cbe1 to your computer and use it in GitHub Desktop.
Save heyseus1/190b99b9f3a7bfe124fb6ab87417cbe1 to your computer and use it in GitHub Desktop.
#!/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