Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasLeCoz/488607dd0e44a7d6b215 to your computer and use it in GitHub Desktop.
Save ThomasLeCoz/488607dd0e44a7d6b215 to your computer and use it in GitHub Desktop.
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