Networking with URLSession · Uploading Data | raywenderlich.com

Hi Brian,

Where should I paste the content of upload.py?

I follow your steps in the video I have everything on my desktop, but still I could not upload this file.

from flask import Flask, request

import sys

app = Flask(name)

@app.route(“/”)

def hello():

return “Hello!”

@app.route(‘/upload’, methods = [‘GET’, ‘POST’])

def saveImage():

print(request.get_data(), file=sys.stderr)

imfile = request.get_data()

with open(‘image.jpg’,‘wb’) as f:

f.write(imfile)

return “Uploaded”

This is what the file contains, but I still didn’t understand why is not uploading, been on this for a while and still I haven’t figured this out

Hi Brian,

The issue was that I didn’t install python in the right terminal window, I opened a new terminal tab for my desktop and now I was able to import the file(at least I learned this one as well) thanks for coming back to me anyway.

I’m glad to hear that you worked through it. In the updated course, I actually decided to drop the Python component since it caused too many headaches. Now, I use a vapor server instead (which is written in Swift).

In any case, nice work!

1 Like

Was a bit, but that’s a beauty of programming , and for me as a beginner is definitely is an achievement.Thank you! I started with UIKit and that’s why I wanted to follow this course SwiftUI is new but I will pick that up after I know how to properly work with UIKit, lot of companies are work with UIKit which will be around long time. The course is good, but each one of us beginners pick things up differently I guess.

@george30 Do you still have issues with this?