-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample.py
104 lines (88 loc) · 2.13 KB
/
example.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env python
import postcodes_io_api
api = postcodes_io_api.Api(debug_http=True)
postcode1 = 'SW112EF'
postcode2 = 'SW112222'
data1 = api.get_postcode(postcode1)
print("\n\n",data1)
#data2 = api.get_postcode(postcode2)
#print(data2)
#run only certain tests
#python setup.py test -s tests.test.PostcodeIOTest.test_get_postcode
"""
lat = 51.466324
lon = -0.173606
data = api.get_nearest_postcodes_for_coordinates(latitude=lat,longitude=lon,limit=2)
print(data)
"""
"""
#data = api.get_bulk_postcodes({"postcodes":["OX49 5NU","M32 0JG","NE30 1DP"]})
list = ["SW112EF"]
data = api.get_bulk_postcodes(list)
print("\n")
print(data)
"""
"""
if api.validate_postcode(postcode1):
print("postcode ="+ postcode1+ " is valid")
else:
print("postcode =" + postcode1 + " is invalid")
if api.validate_postcode(postcode2):
print("postcode ="+ postcode2+ " is valid")
else:
print("postcode =" + postcode2 + " is invalid")
"""
"""
#get random postcode
postcode_data = api.get_random_postcode()
print("random_postcode\n\n",postcode_data)
"""
"""
#get get_nearest_postcodes_for_postcode
data = api.get_nearest_postcodes_for_postcode(postcode='SW112EF')
print("\n",data)
"""
"""
#get
data =api.get_autocomplete_postcode(postcode='SW112E')
print("\n\n",data)
"""
"""
terminated_postcode = 'SW11 2ZW'
#terminated_postcode = 'SW112EF'
if api.is_postcode_terminated(terminated_postcode):
print(terminated_postcode+" is_terminated")
else:
print(terminated_postcode+" is_working_postcode")
"""
"""
payload_data = {
"geolocations": [{
"longitude": 0.629834723775309,
"latitude": 51.7923246977375
}, {
"longitude": -2.49690382054704,
"latitude": 53.5351312861402,
"radius": 1000,
"limit": 5
}]
}
data = api.get_bulk_reverse_geocode(payload_data)
print("\n\n",data)
"""
"""
outcode = 'KT1'
data = api.get_outcode(outcode)
print("\n\n",data)
"""
"""
outcode = 'KT1'
data = api.get_nearest_outcodes_for_outcode(outcode=outcode,limit=2)
print("\n\n",data)
"""
"""
lat = 51.466324
lon = -0.173606
data = api.get_nearest_outcodes_for_coordinates(latitude=lat,longitude=lon,limit=1)
print("\n\n",data)
"""