I'm totally new at this so please bear with my lack of understanding.
What I want to ulitmatley do is get a line of text from a file, then place it into a url (already have that code and understand that), that will give a result. The value from the text file needs to be deleted after loaded.This is what I have so far, it is for a script to find instagram photos using the instagram API.
import time, random
import urllib,json,urllib2
def getuserId(userId):
userId_Dict = {}
try:
list_of_users = open('superlikelist.txt', "r")
for line in list_of_users:
print line
return userIdlist
I will later use the defined value for this
def userspics(userId):
numuserspics=0
urlUserMedia = "https://api.instagram.com/v1/users/%s/media/recent/?access_token=%s" % (getuserId,auth_token)
values = {
'client_id' : client_id}
try:
print urlUserMedia
data = urllib.urlencode(values)
req = urllib2.Request(urlUserMedia,None,headers)
response = urllib2.urlopen(req)
result = response.read()
dataObj = json.loads(result);
picsForUser = random.randint(1, 3)
print "Pics for user %s" % (picsForUser, userId)
countPicViews=0
for picture in dataObj['data']:
countPicViews = countPicViews+1
numLikesFollows = numLikesFollows+1
if(countPicViews == picsToLike):
break
except Exception, e:
print e