We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
''' 此脚本需要将hosts.txt的文件文件操作权限(修改、写入)赋予给当前user,不然会显示拒绝访问! ''' import requests import os
url = "https://github.com/jianboy/github-host/blob/master/hosts" # hosts源码
r = requests.get(url=url)
hosts = r.text
with open('C:\Windows\System32\drivers\etc\hosts.txt', 'w+') as f: f.write(hosts)
os.system("ipconfig /flushdns")
print("hosts文件更新完毕,DNS缓存刷新完毕!")
The text was updated successfully, but these errors were encountered:
可以把
https://github.com/jianboy/github-host/blob/master/hosts
改为
https://git.yoqi.me/lyq/github-host/raw/master/hosts
Sorry, something went wrong.
我也分享下我的代码! https://github.com/JohyC/Hosts
No branches or pull requests
'''
此脚本需要将hosts.txt的文件文件操作权限(修改、写入)赋予给当前user,不然会显示拒绝访问!
'''
import requests
import os
url = "https://github.com/jianboy/github-host/blob/master/hosts" # hosts源码
r = requests.get(url=url)
hosts = r.text
with open('C:\Windows\System32\drivers\etc\hosts.txt', 'w+') as f:
f.write(hosts)
os.system("ipconfig /flushdns")
print("hosts文件更新完毕,DNS缓存刷新完毕!")
The text was updated successfully, but these errors were encountered: