forked from digitalocean/sample-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
27 lines (23 loc) · 648 Bytes
/
server.py
File metadata and controls
27 lines (23 loc) · 648 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import http.server
import socketserver
import json
from web3 import Web3
import boto3
import boto
import boto.s3.connection
from botocore.client import Config
import asyncio
import sched, time
from threading import Thread
from http import HTTPStatus
class Handler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(HTTPStatus.OK)
self.end_headers()
msg = 'Hello! you requested %s' % (self.path)
self.wfile.write(msg.encode())
port = int(os.getenv('PORT', 80))
print('Listening on port %s' % (port))
httpd = socketserver.TCPServer(('', port), Handler)
httpd.serve_forever()