Skip to content

Instantly share code, notes, and snippets.

@lucasrcezimbra
Last active February 28, 2018 12:53
Show Gist options
  • Select an option

  • Save lucasrcezimbra/d628a06f51f1dbf3b95310b1c10e7077 to your computer and use it in GitHub Desktop.

Select an option

Save lucasrcezimbra/d628a06f51f1dbf3b95310b1c10e7077 to your computer and use it in GitHub Desktop.
Get Allegro menu from Facebook
import requests
from decouple import config
FACEBOOK_APP_ID = config('FACEBOOK_APP_ID')
FACEBOOK_APP_SECRET = config('FACEBOOK_APP_SECRET')
FACEBOOK_TOKEN = '{}|{}'.format(FACEBOOK_APP_ID, FACEBOOK_APP_SECRET)
FACEBOOK_URL = 'https://graph.facebook.com/v2.12/'
PARAMS = {'access_token': FACEBOOK_TOKEN}
ALLEGRO_PHOTOS_URL = FACEBOOK_URL + '1555033107877321/photos/'
photos = requests.get(ALLEGRO_PHOTOS_URL, params=PARAMS).json()
last_photo_id = photos['data'][0]['id']
last_photo_url = FACEBOOK_URL + '{}?fields=images'.format(last_photo_id)
images = requests.get(last_photo_url, params=PARAMS).json()
images['images'][0]['source']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment