Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit436f311

Browse files
committed
Added fullcontact api
1 parent24d6113 commit436f311

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+
importsys
2+
importrequests
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+
defget_arguments():
25+
iflen(sys.argv)is3:
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+
defcall_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+
ifr.status_code==200:
40+
returnr.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)

[8]ページ先頭

©2009-2025 Movatter.jp