New to posting and API stuff so sorry if this is an obvious question.
I am building a personal program that is essentially a local version of e621 via python, though it is only certain pictures that I have selected.
I have been using this API to successfully grab the tags from the pictures via their md5 hash up until tonight. But know, for some reason, I cannot seem to get past a 503 error and I am unsure if this is cloudflare throwing the error or e621.
A couple odd things are that I can repeat the same request in my browser (chromium) and receive the data that I want. As well as I have a timer in my code (500 ms) that ensures that I shouldn't get a 503
Again, this was working up until tonight, so I am unsure if there was a change to the site or something is not working.
code for reverence:
def readTags(fn): hashName = fn.split('.')[0] # get hash from downloaded file name url = urllib2.Request("https://e621.net/post/show.json?md5=" + hashName) # create url request url.add_header("User-Agent", "Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0") # I have login information here,but have removed this for obvious reasons tempFile = open("TagFile.txt", 'a') time.sleep(0.5) # Wait to avoid a timeout (503) try: data = json.loads(urllib2.urlopen(url).read())['tags'] # throws 503 anyway (-_-) # file stuff for building a bst later tempFile.write(fn + "@") for s in data.split(' '): tempFile.write(s+"#") tempFile.write("*\n") except Exception as inst: print inst tempFile.write(fn +"@noTag#*\n") # incase I grab a pic from another site tempFile.close()
EDIT: Python 2, Ubuntu on an intel chip, spectrum internet
Updated by Ecstatis