In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is to share with you about how Python builds the Gitee graph bed. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Build a new warehouse
If you do not have an account, first go to the Gitee home page to register the account, and then build a new warehouse named resource and the path res (res is used to make the picture link look more concise)
After the creation is completed, you need to initialize the Readme.md file and copy the address (to use the Gitee Pages service):
Then open the service options:
Click Gitee Pages:
Click "start" to start the service:
Clone warehouse
Find a location on your computer to create a folder, and use the Git Bash command in the folder to clone the repository locally:
Git clone https://gitee.com/xxx/xxx.git
After the cloning is completed, a folder named res is generated locally. You can delete the Readme.md file in the folder and create a new empty folder upload_images in the res folder.
Create an empty folder temp in the same directory as res to store the files to be uploaded:
Get the "API Key" of TinyPng
Go to the TinyPng home page (https://tinypng.com/) and register in the upper right corner:
Enter the email address:
Open email verification, click "Log in with magic link" in the email, click the place where you just registered, and select "Account page":
After successful registration, the following page appears to enable and copy "API Key"
TinyPng supports free conversion of 500 pictures per month, and repeated images are compressed only once, which is enough for people with average number of pictures inserted. If you feel that 500 pictures a month is not enough and you don't want to spend money, you can sign up for several more accounts.
Install the required Python package
The script requires two packages: tinify and GitPython
Open the cmd command prompt and enter the installation instructions:
Pip install-upgrade tinifypip install gitpython
If it fails, you can try to install locally.
Write Python scripts
Create a new upload.py in the same directory as res:
Open the py file with python's IDE and write the following code:
Import randomimport timeimport osimport shutilfrom git import Repoimport tinifyrepo = Repo ('. / res') # create version library object tinify.key ='*'# paste here the image format supported by API Keyexts = ['.png', '.jpg', '.bmp'] # supported by compression = ['.png' '.jpg'] # supports compressed image format srcdir ='. / temp' # Source folder dstdir ='. / res/upload_images' # destination folder url = 'https://xxx.gitee.io/res/upload_images/' # Picture bed path (must add "/" at the end) Replace xxx with your own user name def random_hex (length): result = hex (random.randint). Replace ('0x girls'). Lower () if (len (result)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.