forked from miearls/proofpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
81 lines (69 loc) · 2.47 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import requests
'''
This script pulls data out of Poofpoint API and returns the data as json
Proofpoint API v1.0
Michael Earls
www.michaelearls.com
Python 3.7
'''
def list_org_info(username, password, domain):
'''
:param username:
:param password:
:param domain:
:return: Returns a single organisation identified by :domain in JSON format
'''
url = 'https://us1.proofpointessentials.com/api/v1/orgs/' + domain
headers = {'X-User': username, 'X-Password': password, 'Content-Type': 'application/json'}
r = requests.get(url, headers=headers)
get_json = r.json()
print(get_json)
def list_user_email(username, password, domain, email):
'''
:param username:
:param password:
:param domain:
:param email:
:return: Returns a single user identified by :email from the organisation identified by :domain in JSON format
'''
url = 'https://us1.proofpointessentials.com/api/v1/orgs/' + domain + '/' + 'users' + '/' + email
headers = {'X-User': username, 'X-Password': password, 'Content-Type': 'application/json'}
r = requests.get(url, headers=headers)
get_json = r.json()
print(get_json)
def list_org_licensing(username, password, domain):
'''
:param username:
:param password:
:param domain:
:return: Returns organisation licensing information
'''
url = 'https://us1.proofpointessentials.com/api/v1/orgs/' + domain + '/' + 'licensing'
headers = {'X-User': username, 'X-Password': password, 'Content-Type': 'application/json'}
r = requests.get(url, headers=headers)
get_json = r.json()
print(get_json)
def list_org_domain(username, password, domain):
'''
:param username:
:param password:
:param domain:
:return: Returns a single domain :domain in JSON format
'''
url = 'https://us1.proofpointessentials.com/api/v1/orgs/' + domain + '/domains/' + domain
headers = {'X-User': username, 'X-Password': password, 'Content-Type': 'application/json'}
r = requests.get(url, headers=headers)
get_json = r.json()
print(get_json)
def return_endpoint(username, password, domain):
'''
:param username:
:param password:
:param domain:
:return: Returns the Organization URL
'''
url = 'https://us1.proofpointessentials.com/api/v1/endpoints/' + domain
headers = {'X-User': username, 'X-Password': password, 'Content-Type': 'application/json'}
r = requests.get(url, headers=headers)
get_json = r.json()
print(get_json)