commit
fa2b848715
6 changed files with 67 additions and 4 deletions
@ -0,0 +1,19 @@ |
|||||||
|
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 |
||||||
@ -1,3 +0,0 @@ |
|||||||
broker_url = 'redis://redis:6379/0' |
|
||||||
result_backend = 'redis://redis:6379/1' |
|
||||||
task_serializer = 'json' |
|
||||||
Loading…
Reference in new issue