Compare commits
No commits in common. "4bffbaa71c244c8b5509a09e2c973905c385de6e" and "d756179afc46b7117c8238c1956e74270fa9b84f" have entirely different histories.
4bffbaa71c
...
d756179afc
37
generator.py
37
generator.py
@ -1,37 +0,0 @@
|
||||
import json
|
||||
import urllib.request
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
projects = {
|
||||
'queues': 'tasks.proto'
|
||||
}
|
||||
|
||||
|
||||
try:
|
||||
shutil.rmtree('schemas')
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
os.mkdir('schemas')
|
||||
except:
|
||||
pass
|
||||
|
||||
for project in projects:
|
||||
response = urllib.request.urlopen(f'https://platform.sprinthub.ru/schemas/get?project={project}').read()
|
||||
data = json.loads(response)
|
||||
os.mkdir(f'schemas/{project}')
|
||||
for key, value in data.items():
|
||||
with open(f'schemas/{project}/{key}', 'w+') as fp:
|
||||
fp.write(value)
|
||||
|
||||
|
||||
for key, value in projects.items():
|
||||
os.system(f'python -m grpc_tools.protoc --proto_path schemas --python_out=. --pyi_out=. --grpc_python_out=. ./schemas/{key}/{value}')
|
||||
|
||||
try:
|
||||
shutil.rmtree('schemas')
|
||||
except:
|
||||
pass
|
@ -15,5 +15,4 @@ urlpatterns = [
|
||||
path(*YandexAuthView.as_path()),
|
||||
path('is_staff', is_staff),
|
||||
path('fetch', fetch),
|
||||
path('generator', generator),
|
||||
]
|
||||
|
@ -9,4 +9,3 @@ from .vk_auth import VKAuthView
|
||||
from .yandex_auth import YandexAuthView
|
||||
from .is_staff import is_staff
|
||||
from .fetch import fetch
|
||||
from .generator import generator
|
||||
|
@ -1,5 +0,0 @@
|
||||
from django.http import HttpResponse
|
||||
|
||||
|
||||
def generator(request):
|
||||
return HttpResponse(open('generator.py', 'rb').read())
|
Loading…
Reference in New Issue
Block a user