Hi I am try to create a flask app to access various web APIs and display the information on different pages and import the data to my data base, I have been working on this for months, I am new to python, and nothing is simple to me, I am using flask blueprints, Here is my schema for the app:
etsy_api/
|_ config.
|_ etsy_api.py
|_ db
|_ app/
|_ models.py
| __init__.py "flask function factory with each bp registered"
|_ auth/
|___init__.py "registers blueprint"
|_ forms.py "flask wtforms "class"
|_ routes.py
|_ erdm/
|___init__.py "registers blueprint"
|_ forms.py "flask wtforms "class"
|_ routes.py
|_templates/
|_ base.html
|_ auth/ "templates for auth"
|_ erdm/
|_ Listings.html
I am following and adapting this tutorial here for a blog creation and I have found some etsy code here. The code looks very good, but I dont know how to incorperate it into my app! Do I copy this code into an etsy.py file in the app folder then call it in the erdm/routes.py file, and if so how? On the git site readme file it says; to call listings
e.show_listings(color='#FF00FF')
So how do I make a function of this? If not do I incorperate each function in the etsy file seperatly in the routes.py file as a seperate route (which is what I prefere). This leads to my second problem how do I but a button on the web page to call the function, How do I display the results in a table? Do i use flaskform? I tried to create my own code to request the information but I ran into a problem with the test, even though my code worked here is my code and here is the code that gets the response
from __future__ import print_function
from etsywrapper import Listings
active = Listings.active()
for number, show in enumerate(active['results'], start=1):
print("{num}. {listing_id} - {title}".format(num=number,
listing_id=show['listing_id'], title=show['title']))
this code prints the results that I want but I have know idea how to incorperate this into my app!
I hope there is somebody who understands my problem who can help guide me Regards paul