Skip to content

Add files via upload - #1

Open
UshnahAbbasi wants to merge 9 commits into
mainfrom
UshnahAbbasi-patch-1
Open

Add files via upload#1
UshnahAbbasi wants to merge 9 commits into
mainfrom
UshnahAbbasi-patch-1

Conversation

@UshnahAbbasi

@UshnahAbbasi UshnahAbbasi commented Jun 12, 2023

Copy link
Copy Markdown
Owner
  1. I have used .env file to set environment variables (username and password) for making them secure instead of writing them in .py file.
  2. modular approach has been used (another .py file has the function to make connection to the database)
  3. all information about API (in/out) and database has been added to the readme file

@umerkhalidarbisoft

Copy link
Copy Markdown
Collaborator

Can you please do the following things

  1. improve code using modular approach? e.g. db access separation from the
  2. How can you make application little secure so that you don't have to write username/passwords in the code?
  3. Provide an info how to query the API? for example what is in/out

made some supporting functions for all the tasks associated with database.
Added 3 more columns named hour, minute, second. 
if the timestamp is present in the parameters of request, the exact data row is the output, else if hour or minute or second is given the rows are given as per required. If that particular data doesn't exist in the database, a message saying it doesn't exist is displayed as an output of the request.
@UshnahAbbasi

Copy link
Copy Markdown
Owner Author
  1. I have added the commits from the other request here in this one too and will be deleting that one.
  2. three separate columns have been made
  3. the functions of database have been separated
  4. updated the readme file according to the new request format and respective outputs.

@UshnahAbbasi

Copy link
Copy Markdown
Owner Author

I have updated the files doing the following:

  1. the response of API has been altered such that it has keys now too.
  2. the API has been converted to be of POST method.
  3. the readme file has been updated

Comment thread db_connect.py Outdated
if minute != None:
query = f"SELECT * FROM memory_usage WHERE hour = {hour} and minute ={minute}"
if second != None:
query = f"SELECT * FROM memory_usage WHERE hour = {hour} and minute ={minute} and second={second} "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if I have provided only the "second" value and not the "hour" & "minute" values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants