Created
March 4, 2016 11:04
-
-
Save ThomasLeCoz/488607dd0e44a7d6b215 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_SNIPLY_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']}] | |
return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment