Answer the question
In order to leave comments, you need to log in
How to properly import from .py to .py?
Hello.
I'm having trouble importing a .py file. To be more specific, attributes are not inherited from me.
The file I am trying to import is:
import tweepy
def api():
consumer_key = 'айзабей'
consumer_secret = 'айзабей'
access_token = 'айзабей'
access_token_secret = 'айзабей'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
return api
from flask import Flask, render_template
from tweepy_credentials import api
app = Flask(__name__)
@app.route('/')
def index():
public_tweets = api.home_timeline(count=10)
return render_template('index.html',public_tweets=public_tweets)
if __name__ == '__main__':
app.run(debug=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question