· 4 years ago · Apr 19, 2021, 12:26 AM
1Intro
2=====
3This wrapper has both asynchronous & synchronous support, this intro will cover the basic of both.
4Lucily for you the API for asynchronous (awaiting) & synchronous (blocking) is identical.
5
6
7Getting started
8---------------
9
10**Awaiting**
11
12.. code-block:: python
13
14 import proxycheck
15
16 client = proxycheck.Awaiting(
17 key="..."
18 )
19
20 ip = client.ip("98.75.2.4")
21
22 if await ip.proxy():
23 print("Is proxy")
24
25 risk_score = await ip.risk()
26 latitude, longitude = await ip.geological()
27
28 data = await ip.get()
29
30 # A client should always be closed after being used!
31 await client.close()
32
33
34**Blocking**
35
36.. code-block:: python
37
38 import proxycheck
39
40 client = proxycheck.Blocking(
41 key="..."
42 )
43
44 ip = client.ip("98.75.2.4")
45
46 if ip.proxy():
47 print("Is proxy")
48
49 risk_score = ip.risk()
50 latitude, longitude = ip.geological()
51
52 data = ip.get()
53
54 # Python's garbage collector should
55 # close connections correctly for Blocking.
56 client.close()
57