stalej / weathersim Goto Github PK
View Code? Open in Web Editor NEWHome Page: http://group30.codes/
Home Page: http://group30.codes/
We need to update the README.md
This method is flawed. We need to make a second request to find the size file we are sending.
def request_to_server(request: str) -> str:
sock.sendall(request.encode())
resp = sock.recv(16384)
return resp.decode()
We need
sock.reciv(file_size)
So that we don't overflow the recv buffer
Vi må lage flere muligheter til flere kommandoer som vi kan sende i "terminalen".
Forslag kan være
get data <day>
get data <place>
get data <month>
get data rain
get data temp
Må finne en måte å catche OSError
Error when trying to fetch all data form data.json
WAclient> get data all
Traceback (most recent call last):
File "WeatherAppClient.py", line 107, in <module>
get_all_data()
File "WeatherAppClient.py", line 29, in get_all_data
all_data = get_json("getall") # loads converts str -> dict
File "WeatherAppClient.py", line 16, in get_json
_data = json.loads(request_to_server(request))
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 1 (char 0)
A small error in the readme. data sender is not on the server but station
$ python server/server.py
$ python server/weather_station_data_sender.py
$ python server/client_server.py
$ python client/WeatherAppClient.py
Describe the bug:
When in the project root directory, if you run the code from as described in the readme the code will fail eventually. It is caused by that the files/servers are coded to be run from the folder they are in.
So we could either change the readme or the code:
A change in the readme would look like:
Then run from project root:
$ cd server
$ python server.py
$ python weather_station_data_sender.py
$ python client_server.py
$ cd ../client
$ python WeatherAppClient.py
or a code change would look going from, for example this:
DATABASE = "data.json"
HELP = "requests.json"
to this:
DATABASE = "./server/data.json"
HELP = "./server/requests.json"
in every relevant files. What you guys think?
Can someone one Linux or windows check if weatherappclient can still talk to the server? or it's a mac problem?
λ python3 WeatherAppClient.py ⏎ [3m] ✭
Press Enter to exit
WAclient> get data all
Traceback (most recent call last):
File "/Users/stale/Skole/oblig1-142/client/WeatherAppClient.py", line 102, in <module>
get_all_data()
File "/Users/stale/Skole/oblig1-142/client/WeatherAppClient.py", line 36, in get_all_data
all_data = get_json("getall") # loads converts str -> dict
File "/Users/stale/Skole/oblig1-142/client/WeatherAppClient.py", line 23, in get_json
_data = json.loads(request_to_server(request))
File "/Users/stale/Skole/oblig1-142/client/WeatherAppClient.py", line 14, in request_to_server
size_of_file = int(sock.recv(512).decode())
ValueError: invalid literal for int() with base 10: ''
In the diagram model ther eis inacurate URL for the website. It says 30group.code.
Se picture
The correct URL is group30.codes
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.