Exemplo n.º 1
0
    def do_GET(self):
        """Get requests."""
        q = urlparse(self.path)
        request = {
            "headers": dict(self.headers),
            "path": q.path,
            "queryStringParameters": dict(parse_qsl(q.query)),
            "httpMethod": self.command,
        }
        response = APP(request, None)

        self.send_response(int(response["statusCode"]))
        for r in response["headers"]:
            self.send_header(r, response["headers"][r])
        self.end_headers()

        if isinstance(response["body"], str):
            self.wfile.write(bytes(response["body"], "utf-8"))
        else:
            self.wfile.write(response["body"])
Exemplo n.º 2
0
def main(place, date=None, forecast=None):
    """
    The main method takes the command line arguments and call the app.py
    to get the info of entered place

    """
    if not date:
        date = (datetime.date.today()).strftime("%b %d").upper()

    if not forecast:
        forecast = "monthly"

    obj = APP(place, date, forecast)
    
    try:
        data = obj.run()
        
        if not data:
            return {}

        return data
    except:
        return {}
Exemplo n.º 3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from app import APP

if __name__ == '__main__':
    application = APP()
    application.run()
Exemplo n.º 4
0
from app import APP

app = APP()
app.start()