-
-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathquery.py
More file actions
34 lines (29 loc) · 741 Bytes
/
Copy pathquery.py
File metadata and controls
34 lines (29 loc) · 741 Bytes
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
import asyncio
import wreq
async def main():
# Send list of tuples as query parameters
resp = await wreq.get(
"https://httpbin.io/anything",
query=[
("key1", "value1"),
("key2", "value2"),
("number", 123),
("flag", True),
("float", 45.67),
],
)
print(await resp.text())
# OR send dictionary as query parameters
resp = await wreq.get(
"https://httpbin.io/anything",
query={
"keyA": "valueA",
"keyB": "valueB",
"number": 789,
"flag": False,
"float": 12.34,
},
)
print(await resp.text())
if __name__ == "__main__":
asyncio.run(main())