forked from tnmygrwl/docker-hub-data
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi_requests.py
More file actions
40 lines (25 loc) · 915 Bytes
/
api_requests.py
File metadata and controls
40 lines (25 loc) · 915 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
35
36
37
38
39
40
import requests
url = "https://hub.docker.com/api/content/v1/products/search"
querystring = {"page_size": "25", "q": "", "type": "image", "page": "3"}
payload = ""
headers = {
'cache-control': "no-cache",
}
response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
print(response.text)
'''For repositories'''
# url = "https://hub.docker.com/v2/repositories/library/busybox/"
# payload = ""
# headers = {
# 'cache-control': "no-cache",
# }
# response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
# print(response.text)
'''For DockerFiles (available across a few repos only)'''
# url = "https://hub.docker.com/v2/repositories/swce/keyval-resource/dockerfile/"
# payload = ""
# headers = {
# 'cache-control': "no-cache",
# }
# response = requests.request("GET", url, data=payload, headers=headers)
# print(response.text)