Skip to content

Commit 436f311

Browse files
committed
Added fullcontact api
1 parent 24d6113 commit 436f311

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

30_fullcontact.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import sys
2+
import requests
3+
4+
"""
5+
6+
1. pip install requests
7+
2. Obtain an API key: https://www.fullcontact.com/developer/pricing/
8+
9+
Example usage:
10+
11+
$ python 30_fullcontact.py email SOME@EMAIL.COM
12+
$ python 30_fullcontact.py twitter TWITTER_HANDLE
13+
"""
14+
15+
16+
# constants
17+
18+
API_KEY = 'GET YOUR OWN'
19+
BASE_URL = 'http://api.fullcontact.com/v2/person.json'
20+
21+
22+
# helpers
23+
24+
def get_arguments():
25+
if len(sys.argv) is 3:
26+
return {
27+
'media': sys.argv[1],
28+
'user_info': sys.argv[2]
29+
}
30+
else:
31+
print('Specify at least 1 argument')
32+
sys.exit()
33+
34+
35+
def call_api(contact):
36+
url = BASE_URL + '?{0}={1}&apiKey={2}'.format(
37+
contact['media'], contact['user_info'], API_KEY)
38+
r = requests.get(url)
39+
if r.status_code == 200:
40+
return r.text
41+
else:
42+
return "Sorry, no results found."
43+
44+
45+
# main
46+
47+
if __name__ == "__main__":
48+
media = get_arguments()
49+
print(call_api(media))

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@
2929
1. **27_send_sms.py**: Send SMS message via [TextBelt](http://textbelt.com/)
3030
1. **28_income_tax_calculator.py**: Income tax calculator via [Taxee](http://taxee.io/)
3131
1. **29_json_to_yaml.py**: Convert JSON to YAML
32+
1. **30_fullcontact.py**: Call the [FullcContact](https://www.fullcontact.com/developer/) API

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy