You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
533 B
19 lines
533 B
import json
|
|
from time import sleep
|
|
from project.celery import app
|
|
from constance import config
|
|
from InstagramAPI import InstagramAPI
|
|
|
|
|
|
@app.task
|
|
def retrieve_photos():
|
|
instagram = InstagramAPI(
|
|
config.INSTAGRAM_CLIENT_LOGIN,
|
|
config.INSTAGRAM_CLIENT_PASSWORD,
|
|
)
|
|
instagram.login()
|
|
sleep(1)
|
|
if instagram.isLoggedIn and instagram.getHashtagFeed(config.INSTAGRAM_RESULTS_TAG):
|
|
with open('s.json', 'w') as f:
|
|
f.write(json.dumps(instagram.LastJson))
|
|
return instagram.LastJson
|
|
|