Created
February 17, 2016 12:31
-
-
Save ThomasLeCoz/5890ad71bc68d0e091d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
auth_token_sniply = 'YOUR_AUTH_TOKEN' | |
campaign_id = 'YOUR_CAMPAIGN_ID' | |
headers = {'Authorization': 'Bearer ' + auth_token_sniply, 'Content-Type': 'application/json'} | |
payload = {'url': input['url'], 'campaign': campaign_id} | |
r = requests.post('https://snip.ly/api/v2/links/', data=json.dumps(payload), headers=headers) | |
r.raise_for_status() | |
output = [{'url': r.json()['href'], 'title': input['title'], 'excerpt': input['excerpt'], 'image': input['image']}] | |
return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment