Files
VirtualChemistry/nuget_update.py
2024-06-23 04:33:03 +08:00

17 lines
466 B
Python

import requests
r = requests.get('http://127.0.0.1:3000/api/packages/hzhang/nuget/query')
res = r.text
d = eval(res)
version = ""
for x in d['data']:
if x['id'] == 'Skeleton':
version = x['version']
w = open('VirtualChemistry.csproj', 'r').read()
s = w.split('<ItemGroup>')
s[1] = '\n<PackageReference Include="Skeleton" Version="'+version+'"/>\n' + s[1]
w = '<ItemGroup>'.join(s)
print(w)
with open('VirtualChemistry.csproj', 'w') as f:
f.write(w)