Skip to content

Commit d31b4ad

Browse files
Add files via upload
1 parent 0640d8e commit d31b4ad

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import requests
2+
3+
payload1 = {'key1': 'value1', 'key2': 'value2'}
4+
r = requests.post("https://httpbin.org/post", data=payload1)
5+
print(r.text)
6+
7+
payload2 = [('key1', 'value1'), ('key1', 'value2')]
8+
r1 = requests.post('https://httpbin.org/post', data=payload2)
9+
print(r1.text)
10+
11+
payload3 = {'key1': ['value1', 'value2']}
12+
r2 = requests.post('https://httpbin.org/post', data=payload3)
13+
print(r2.text)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import requests
2+
from getpass import getpass
3+
4+
r=requests.get('https://test.org', auth=('username', getpass()))
5+
print(r.status_code)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import requests
2+
3+
r = requests.get('https://api.github.com/users', auth=('your username', 'your personal access token'))
4+
5+
print(r.status_code)
6+
print(r.headers['content-type'])
7+
print(r.encoding)
8+
print(r.text)
9+
print(r.json())

0 commit comments

Comments
 (0)