Repository navigation
Expand file tree
/
Copy pathtest_webcache.py
More file actions
61 lines (42 loc) · 1.86 KB
/
Copy pathtest_webcache.py
File metadata and controls
61 lines (42 loc) · 1.86 KB
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
import json
from webcacheclient import WebCacheClient
def play_get_request():
client = WebCacheClient()
urlList = [f"https://nominatim.openstreetmap.org/search/Credit Suisse,{zipcode},Switzerland?osm_type=N&format=json"
for zipcode in range(2095, 2099)]
ret = client.fetchURLs(urlList, category="OSM-geocoding", output="json")
print(ret)
def play_get_request():
import sys
client = WebCacheClient()
urlList = [f"https://nominatim.openstreetmap.org/search/Bank,{zipcode},Switzerland?osm_type=N&format=json"
for zipcode in range(2095, 2199)]
ret = client.fetchURLs(urlList, category="OSM-geocoding", output="json")
print(ret)
def play_get_request_without_proxies():
client = WebCacheClient()
urlList = ["http://localhost:7070/search/Switzerland?osm_type=N&format=json",
"http://localhost:7070/search/Germany?osm_type=N&format=json"]
ret = client.fetchURLs(urlList, category="OSM-geocoding", output="json")
print(ret)
def play_post_request():
client = WebCacheClient()
urlList = [f"https://search.wdoms.org?sSchoolName={medschool}&iPageNumber=1" for medschool in
['Basel', 'Zürich', 'London']]
ret = client.fetchURLs(urlList, category="medschool", output="xml", method="POST")
print(ret)
def play_post_data_request():
client = WebCacheClient()
urlList = [("https://search.wdoms.org", json.dumps({'sSchoolName': medschool, 'iPageNumber': 1})) for medschool in
['Basel', 'Zürich', 'London']]
ret = client.fetchURLs(urlList, category="medschool", output="xml", method="POST")
print(ret)
def getProxy():
client = WebCacheClient()
print(client.getProxyList(10000))
if __name__ == '__main__':
# play_post_request()
# play_post_data_request()
play_get_request()
#play_get_request_without_proxies()
# getProxy()