Exemple #1
0
def main():
    if os.getenv("only_run_web", 'False') != 'True':
        collect_user_match_info()
    server.run()
Exemple #2
0
from web import server

if __name__=="__main__":
    server.run()
Exemple #3
0
ap_if = network.WLAN(network.AP_IF)
ap_if.active(False)

sta_if = network.WLAN(network.STA_IF)
sta_if.active(False)

items = []

print('[-] Iniciando sistema.')
with open("config.json", "r") as outfile:
    data = ujson.load(outfile)
    subdata = data['config']
    for item in subdata:
        items.append(item['network'])
        items.append(item['wifi'])
        items.append(item['mqtt'])
        items.append(item['mode'])

if 'NO' in items:
    print('[!] Sistema sin configuracion.')

    mac = ubinascii.hexlify(ap_if.config('mac'), ':').decode()
    essid = 'ESP_Config_' + mac

    ap_if.active(True)
    ap_if.config(essid=essid, authmode=0)

    server.run()

    machine.reset()
      destination = 'http://www.%s/shootit?label=%s' % (settings.DOMAIN,label)
    return Response(redirect=destination, status_code=301)

def shootit(request):
  errors = []
  if request.method == 'POST':
    orig_label = request.POST['label']
    label = cleanup_label(orig_label)
    destination = request.POST['destination']
    if label == "":
      errors.append("Your label (%s) is invalid. Shoot something else." % orig_label)
    elif Redirection.select("where label = {label}", {'label':label}):
      errors.append('That label already exists')
    else:
      if not destination.startswith('http://'): destination = 'http://%s' % destination
      Redirection(label=label, destination=destination, counter=0).save()
      url = "%s.%s" % (label, settings.DOMAIN)
      errors.append('<a href="http://%s">%s</a> has been created and points to %s' % (url, url, destination))
  return page("templates/shootit.html", errors=errors)

urls = (
  (r'^/$', index, 'index'),
  (r'^/shootit$', shootit, 'shootit')
)

application = Application(urls)

if __name__ == '__main__':
  from web import server
  server.run(application, autoreload=True)
Exemple #5
0
    # [('A', 'B'), ('A', 'C'), ...] B tetangga A, C tetangga A
    arrNeigh = tetangga(arr, listNode)
<<<<<<< HEAD
    # [['1', '2'], ['2', '1'], ['1','1'], ...] elmt pertama adalah latitude, dan kedua adalah longitude
=======
    # [['1', '2'], ['2', '1'], ['1','1'], ...] elmt pertama adalah ada latitude, dan kedua adalah longitude
>>>>>>> 90119aa580fffc472fd1178a2727ca0a9dacabf9
    loc = coordinates(arr)
    matrixDistance = matrixJarak(arr, loc)
    # 0 2 1
    # 2 0 2
    # 1 2 0
    src = str(input("Masukkan node awal : "))  # A
    dest = str(input("Masukkan node tujuan : "))  # G
    # [('A', 0), ('B', 20.62), ('G', 159.84)], elmt kedua dari tuple dalam satuan meter
    jalan = closestPath(src, dest, arrNeigh, matrixDistance, listNode)
<<<<<<< HEAD
    print(jalan)

# apabila pada terminal 'dijalankan python main.py gui' maka akan menjalankan GUI berupa
# web lokal yang telah dibuat
=======

>>>>>>> 90119aa580fffc472fd1178a2727ca0a9dacabf9
else:
    if sys.argv[1] == "gui":
        server.run(port=5000, debug=True)

    else:
        print("Invalid command, either run \"python3 main.py web\" or \"python3 main.py\"")
Exemple #6
0
def main():
    server.run()