Skip to content

Commit 2a62e21

Browse files
Merge pull request #58 from vector-ai/feature/update_badges
Add downloading badges
2 parents d73e9d8 + b308a5d commit 2a62e21

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

utils/download_badges.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import requests
2+
def download_image(url, output_image_file):
3+
r = requests.get(url)
4+
with open(output_image_file, 'w') as f:
5+
if isinstance(r.content, bytes):
6+
content = r.content.decode()
7+
else:
8+
content = r.content
9+
f.write(content)
10+
11+
if __name__=="__main__":
12+
13+
download_image("https://static.pepy.tech/personalized-badge/vectorai-nightly?period=total&units=none&left_color=black&right_color=purple&left_text=Total%20Downloads",
14+
"assets/total_downloads.svg")
15+
download_image("https://static.pepy.tech/personalized-badge/vectorai-nightly?period=week&units=none&left_color=black&right_color=purple&left_text=Weekly%20Downloads",
16+
"assets/weekly_downloads.svg")
17+
download_image("https://static.pepy.tech/personalized-badge/vectorai-nightly?period=month&units=none&left_color=black&right_color=purple&left_text=Monthly%20Downloads",
18+
"assets/monthly_downloads.svg")

0 commit comments

Comments
 (0)