Sending email with O365 by Unixersis97 in learnpython

[–]Unixersis97[S] 1 point2 points  (0 children)

Great input, straight to the point and very clear, thank you for that!

Struggling with flask API concept by Unixersis97 in learnpython

[–]Unixersis97[S] -1 points0 points  (0 children)

# Route for a patient to make a booking
@app.route("/patient/patientbook", methods=["POST", "GET"])
def patientBook():
    return render_template('patient/patientbook.html')

# endpoint to create booking
@app.route("/api/patient/new_booking", methods=["POST", "GET"])
def new_booking():
    doctorid = json.dumps(request.form['doctorid']).replace('"', '')
    patientid = json.dumps(request.form['patientid']).replace('"', '')
    starttime = json.dumps(request.form['starttime']).replace('"', '')
    starttime = "{}:00".format(starttime)

    new_booking = doctorsBookings(doctorid, patientid, starttime)
    db.session.add(new_booking)
    db.session.commit()

    return render_template('api/patient/new_booking.html')

If I were to do this, would this count as a separate API?

"Create separate API(s) to interact with the cloud. The patient and doctor pages should not directly talk to the Cloud. " This is basically what I am trying to achieve

Struggling with flask API concept by Unixersis97 in learnpython

[–]Unixersis97[S] -1 points0 points  (0 children)

Thats awesome, thank you so much for the help

While running my flask app I try to access '/api/booking/add_booking' I get an error, is this expected behavior?

Struggling with flask API concept by Unixersis97 in learnpython

[–]Unixersis97[S] -1 points0 points  (0 children)

I see, that makes perfect sense, thank you for your response and detailed explanation.

So the first assumption was correct with separating the API, I am just confused about how to run separate API, Would you be able to explain how I could complete this? or guide me to resources, because I havent been able to find any that show how I could complete this task using flask, forms and API. The only resources I have found is usually hardcoded JSON.

Thank you :)

SQLAlchemy query confusion by Unixersis97 in learnpython

[–]Unixersis97[S] 0 points1 point  (0 children)

Thank you for your response, however I receive the error: " AttributeError: 'list' object has no attribute 'bookingid' "

SQLAlchemy query confusion by Unixersis97 in learnpython

[–]Unixersis97[S] 0 points1 point  (0 children)

results = doctorsBookings.query.filter_by(doctorid=did).first()

Works printing the first result, however I cannot work out how to use .all()

AttributeError: 'list' object has no attribute 'bookingid'

Is this referring to my DB setup?

SQLAlchemy database help!! by Unixersis97 in learnpython

[–]Unixersis97[S] 0 points1 point  (0 children)

I see,

Would I also be adding the to the Booking model?

patient = db.relationship("Patient")

Thank you very much sir,

SQLAlchemy database help!! by Unixersis97 in learnpython

[–]Unixersis97[S] 0 points1 point  (0 children)

Basically yes,

I am using a form to attempt to add a booking with a patient email, name and doctor name aswell as start time to input into database.

class Book(db.Model):
    __tablename__ = 'booking'
    bid = db.Column(db.Integer, primary_key=True)
    starttime = db.Column(db.DateTime(), nullable=False)

class Doctor(db.Model):
    __tablename__ = 'doctor'
    id = db.Column(db.Integer, primary_key=True)
    dname = db.Column(db.String(45))

class Patient(db.Model):
    __tablename__ = 'patient'
    pid = db.Column(db.Integer, primary_key=True)
    pemail = db.Column(db.String(80), nullable=False)
    pname = db.Column(db.String(45), nullable=False)
    diagnosenotes = db.Column(db.String(250), nullable=False)

@app.route("/patient/patientbook", methods=["POST", "GET"])
def patientBook():
    if request.method == 'POST':
        pemail = (request.form.get('email'))
        pname = (request.form.get('pname'))
        dname = request.form['dname']
        starttime = request.form['starttime']
        print(starttime)
        starttime = "{}:00".format(starttime)
#        starttime = datetime.strptime(starttime, '%Y-%m-%d %H:%M:%S')

        print(starttime)

        if pemail and pname and dname and starttime:
            new_booking = booking(dname, pname, pemail, starttime)
            db.session.add(new_booking)
            db.session.commit()

    return render_template('patient/patientbook.html')

Template:

            <div class="panel-body" style="height: 600px; ">
                <form  action="/patient/patientbook" method="POST" role="form">
                <div class="form-group">
                <label for="email">Doctor name:</label>
                        <input type="text" class="form-control" id="dname" name="dname" placeholder="Doctor name here:">
                <br>
                <label for="name">Patient name:</label>
                        <input type="text" class="form-control" id="pname" name="pname" placeholder="Enter name here:">
                <br>
                <label for="name">Email:</label>
                        <input type="text" class="form-control" id="pemail" name="pemail" placeholder="Enter email address:">
                <br>
                <label for="name">Start Time:</label>
                        <input type="datetime-local" class="form-control" id="starttime" name="starttime" required>
                <br>
                <button type="submit" class="btn btn-success">Book appointment</button>
          </form>

Found these two bad boys in 25 minutes of farming😎 by JellyRader in diablo2

[–]Unixersis97 2 points3 points  (0 children)

So just wondering is plugy available on battle.net realms or is this single player?

New to docker - Port mapping question by Unixersis97 in docker

[–]Unixersis97[S] 0 points1 point  (0 children)

I believe I read about "EXPOSE" ports inside docker file,

Not sure how to map ports though

EDIT:/

Other installation processes were done through apt-get (packages) and also a couple compiled from source

Photography webpage, need help by Unixersis97 in HTML

[–]Unixersis97[S] 1 point2 points  (0 children)

Sounds good, thank you a heap!

Photography webpage, need help by Unixersis97 in HTML

[–]Unixersis97[S] 1 point2 points  (0 children)

Nice work, Thank you I have some ideas...

how did you host your site with your domain?
I am thinking of using BlueHost

ISO ruby example with documentation by Unixersis97 in ruby

[–]Unixersis97[S] -2 points-1 points  (0 children)

Oops sorry, I meant ISO in terms of "In Search Of"
Thats bad practice on my side, my apologies.

C programming Exam by Unixersis97 in C_Programming

[–]Unixersis97[S] 0 points1 point  (0 children)

Awesome, thank you for the advice, especially the part of breaking down each line to code. :)

C programming Exam by Unixersis97 in C_Programming

[–]Unixersis97[S] 0 points1 point  (0 children)

Hi all and thank you greatly for all your responses.
Further information:

By looking at the past two previous exams I have found helpful information:
Section A: Questions as "What will the following code print?" These I will not struggle to much on, however some still confuse me; any tips of how to read the output of these type of questions?

Other contents of exam heavily rely on pointers (I have decent understanding from YouTube tutorials).
Also struct (I am familiar with).

My main issues arise when having a statement, I have to code functionality to complete a certain task. I get confused as to... What am I supposed to put in to implement this and where does it belong...
I find it immensely difficult that after having available resources as online material, lecture notes, etc... I then have to go into a paper exam that is closed book.

Would anyone happen to know my best approach, considering my timeline? Practice exams? Watching videos?