I want to write a python function that allows me to scrape a website given a url, that will interface with a flutter mobile application. I have written the very basic code on python, but now I have no clue whatsoever on how to integrate it Google Cloud. Would really appreciate some walkthrough help.
My code model is as follows:
import timeago
import pytz
from bs4 import BeautifulSoup
from time import mktime
from datetime import datetime
def Parser(url):
......# URL PARSING
......
......
return domain_name, page_title, clean_txt, timestamp
url = '******************'
file = Parser(url)
print (file[0], file [1], file [2], file [3])
I have tried looking at many examples online, and most of them use flask. I do not understand what flask is used for to be honest, and how to use it for Google Cloud Functions (or any cloud functions for that matter). As far as I understand, I should put my requirements.txt file as follows:
timeago
pytz
mktime
bs4
datetime
If so, then how should I define my imports (i.e. the from bs4 import BeautifulSoup, etc) statements?
Also, how can I call these functions to my flutter app code? I have the url for the cloud function, but don't know what to do with it. I tried going through the official documentation, but most of it is just "Hello World" code that is barely of any use to understand (for me), due to the lack of any input or output arguments.
Thanks and cheers