Files
Gainsight/Scripts/API_Tests/workato_for_test.py

31 lines
783 B
Python
Raw Normal View History

import json
import pprint
import requests
import Apikeys
BASEURLEMAIL = "https://api.northpass.com/v2/people?filter[email][cont]="
APIKEY = Apikeys.DATASNIPPER
def getfromEmail(BASEURLEMAIL, APIKEY):
email = "email.com"
url = BASEURLEMAIL + f"{email}"
headers = {
"accept": "*/*",
"x-api-key": APIKEY,
"content-type": "application/json",
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
print("200 Error!")
else:
print("Another Error!")
# response = response.json()
email = str(response.text)
print(email)
input_json = json.loads(email)
for item in input_json["data"]:
print(item["id"])
if __name__ == "__main__":
getfromEmail(BASEURLEMAIL, APIKEY)