To avoid tweets becoming caught in the twitter spam filter I have some code that goes to tinyurl and creates a new short url each time the code is run for each of the original urls. What i want is each time 'u'
is printed, it's value should be passed to a variable 'linkvar1', 'linkvar2', 'linkvar3'
etc. This is the passed to the tweet submission later in the code:
import simplejson
import httplib2
import twitter
import tinyurl
print("Python will now attempt to submit tweets to twitter...")
try:
api = twitter.Api(consumer_key='',
consumer_secret='',
access_token_key='',
access_token_secret='')
for u in tinyurl.create('http://audiotechracy.blogspot.co.uk/2014/03/reviewing-synapse-antidote-rack.html',
'http://audiotechracy.blogspot.co.uk/2014/03/free-guitar-patches-for-propellerhead.html',
'http://audiotechracy.blogspot.co.uk/2014/02/get-free-propellerhead-rock-and-metal.html',
):
print u
linkvar1 = u
linkvar2 = u
linkvar3 = u
status = api.PostUpdate("The new Synapse Antidote Rack Extension:" + linkvar1 + " #propellerhead #synapse")
status = api.PostUpdate("Free Propellerhead guitar patches for everyone!" + linkvar2 + " #propellerhead #reason #guitar")
status = api.PostUpdate("Free Metal and Rock drum samples!" + linkvar3 + " #propellerhead #reason)
print("Tweets submitted successfully!")
except Exception,e:
print str(e)
print("Twitter submissions have failed!!!")
However at the minute all this does is use the tinyurl generated last for all tweets submitted. I'm sure this is an easy fix that I'm just being stupid about, but does anyone know how to do what I want?
Thanks