Browse Source

adding progress after 3 dec; left to do: figure out system errors + database

master
ccl 4 years ago
parent
commit
e073e050cb
  1. 263
      api.py
  2. 73
      refusal_messages.py
  3. 1
      refused_words.py
  4. 1
      removed_words.py
  5. 1
      static/files/slogans.json

263
api.py

@ -1,102 +1,37 @@
import flask, random import flask, random, datetime, json
from flask import request, jsonify from flask import request, jsonify
app = flask.Flask(__name__, static_url_path='', static_folder='static') app = flask.Flask(__name__, static_url_path='', static_folder='static')
app.config["DEBUG"] = True app.config["DEBUG"] = True
# Not using this atm but might come in handy later
path = "/static/files/"
# Loading the file
availableWords = open('static/files/RNN_EditedText.txt', 'r', encoding='utf8') availableWords = open('static/files/RNN_EditedText.txt', 'r', encoding='utf8')
wordList = availableWords.read() wordList = availableWords.read()
wordList = wordList.split() wordList = wordList.split()
seedText = "not for self but for all" seedText = "not for self but for all"
seedTextList = seedText.split() seedTextList = seedText.split()
# Removing refused words from removed_words import delWords
delWords = ["for", "a", "national", "lillian", "christian", "nationally", "john", "father", "religion"]
for word in wordList: for word in wordList:
for delword in delWords: for delword in delWords:
if word == delword: if word == delword:
wordList.remove(word) wordList.remove(word)
# Refusal messages from refused_words import refWords
refusal_messages = [
"new desires, new modes of gender, and new struggles are breaking open", from refusal_messages import refusal_messages
"We need new words sufficient to speak both of the limits and potential of our time.",
"The collective self-determination of gender", def build_error_one():
"Gender relations are not natural but historical — tied to cycles of accumulation and crisis and the political struggle against them.", refusalOne = 'Your motto request is refused. REFUSAL 400: ' + random.choice(refusal_messages)
"The current gender regime is the index of a particular configuration of class power.", return(refusalOne)
"struggle will be the creation of new language and new concepts with which to grasp capitalist sexual and gender relations.",
"A Becoming Autonomous Zone (BAZ) of desirous mixings and recombinations; splicing female sexual liberation and autonomy with cyberfeminist skills, theory, embodiment, and political activism", def build_error_two():
"A critical space of liberated social becoming and intellectual life", refusalTwo = 'Your motto request is refused. REFUSAL 401: ' + random.choice(refusal_messages)
"a space resistant to mono-culture in all its social, environmental, libidinal, political, and genetic forms.", return(refusalTwo)
"A place of imaginative inertia that slows down the engines of corporate agro/biotech and allows time to assess its risks and benefits through long-term testing",
"To dream the dreams of another",
"To recite all the stories of the world",
"To be aware of all flights, their departure points and their arrival points",
"To invert the sexes",
"To know exactly how many times someone has cried",
"To invert hierarchies",
"we think feminism is still one of the few ideals we can hang on to in order not to be completely disillusioned by the state of the world today.",
"All we need is Action!",
"make a horizontal system in which we all express ourselves equally and freely",
"we seek for a better, equal system for all",
"Claim your place. ",
"Lead a double life. Be a split personality. Be two, three, four, five artists in one body",
"Be a hybrid",
"Complain, complain, complain. But be creative about it.",
"In order to create a more mutual and sustainable relationship with the Earth, we collaborate with nature.",
"Whether on farms, at sea, in the woods, or in small towns or large cities, we connect and empathize with nature.",
"eat code and die. Sucked in, down through a vortex of banality. You have just missed the twentieth century.",
"where code dictates pleasure and satisfies desire.",
"The pleasure's in the dematerialisation. The devolution of desire.",
"The limit is permission denied, vision doubled, and flesh necrotic.",
"The limit is NO CARRIER, the sudden shock of no contact, reaching out to touch but the skin is cold...",
"Endless confusion – endless pleasure!",
"Stop making sense.",
"Produce more noise.",
"Recognize that violence against queers can affect anyone.",
"The means of oppression of many groups intersect in ways that need to be analyzed and understood.",
"Find cracks at the margins of conservative and homogeneous social structures.",
"everyday you wake up alive, relatively happy, and a functioning human being, you are committing a rebellious act.",
"You as an alive and functioning queer are a revolutionary.",
"They are your enemy when they don't acknowledge your invisibility and continue to live in and contribute to a culture that kills you.",
"In cultured circles, queers may quietly coexist with an otherwise disapproving power elite.",
"Shouted.",
"Be proud. Do whatever you need to do to tear yourself away from your customary state of acceptance. Be free. Shout.",
"I hate that I grew up thinking I was the only queer in the world, and I hate even more that most queer kids still grow up the same way.",
"The right to be included belongs to everyone.",
"We have the right to move and the right to not be forced to move.",
"We witness how fear creates boundaries, how boundaries create hate and how hate only serves the oppressors.",
"cyberfeminism is not error 101",
"corrupting the discourse",
"Why aren’t the people in/of the Third World playing any significant role in the development of so-called international art?",
"Are we black people considered part of the society or merely looked down upon as immigrant workers?",
" We cannot expect the indigenous art to flourish under the imposing shadow of an alien culture and this shadow is not going to disappear until the tree of imperialism",
"Our art must therefore be oriented towards anti-imperialist struggle.",
"art must also wage struggle against domination and reactionary forces/ideas within its own sphere, without being discarded for political activity and without being separated from it.",
"Behind this facade of universality lay the desire to impose Western values on rest of the world.",
"The tools are often stories, retold stories, versions that reverse and displace the hierarchical dualisms of naturalized identities.",
"cyborg politics insist on noise and advocate pollution, rejoicing in the illegitimate fusions of animal and machine",
"machines can be prosthetic devices, intimate components, friendly selves.",
"Cyborg imagery can suggest a way out of the maze of dualisms in which we have explained our bodies and our tools to ourselves.",
"Black Power is not out to win the Civil Rights struggle, but to win the Human Rights struggle.",
"when was the last time you encountered a dominant piece of cultural production that really—really—took seriously the sense of queer life beyond tolerable (or routine) tokenism?",
"I want queer stories across the spectrum, up and down Brokeback Mountain and every other peak and valley.",
"Give back, give back, give back is ringing in my years, in my ears, in my year ears.",
"RENEW, RECOMMIT, RECONNECT in the vortex of freedom to be found in the collective queer imaginary!",
"We must take back the camera not simply to create our own stories but to prove that there are indeed other ways of being and knowing that challenge the notions of a pathological native",
"The normality kills me and we are ever so normal.",
"slice it up tear it up go baby go rip it up mix it up know baby know",
"Imagination, not formulaic narratives.",
"More laughter, less finger-wagging.",
"Stop nation building and start soul-searching!",
"Only soul power can help us survive a world where everything is blowing dry in the cosmic wind."
]
def build_error_three():
refusalThree = 'Your motto request is refused. REFUSAL 402: ' + random.choice(refusal_messages)
return(refusalThree)
# Generating a dict that will be used for the phrases when called upon # Generating a dict that will be used for the phrases when called upon
toChooseFrom = {} toChooseFrom = {}
@ -108,7 +43,6 @@ def build_word_dict():
# Going through the letters in the above word # Going through the letters in the above word
for y in range(len(current)): for y in range(len(current)):
charNeeded = current[y] charNeeded = current[y]
# print (y, charNeeded)
for item in wordList: for item in wordList:
if (len(item)-1) >= y: if (len(item)-1) >= y:
addKey = str(y) + item[y] addKey = str(y) + item[y]
@ -117,33 +51,49 @@ def build_word_dict():
toChooseFrom[addKey].append(item) toChooseFrom[addKey].append(item)
else: else:
toChooseFrom[addKey].append(item) toChooseFrom[addKey].append(item)
# print(str(y), item[y], item)
build_word_dict() build_word_dict()
# print(toChooseFrom)
# Example json file
# slogans = {
# 'description' : 'Description here...',
# Create some test data for our catalog in the form of a list of dictionaries. # 'source' : 'git url?',
slogans = [ # 'data' : [
{'id': 0, # {'generated_motto': "not no but fore possible particular southerner being all different be outside not find to our art black culture",
'generated_motto': "not no but fore possible particular southerner being all different be outside not find to our art black culture", # 'timestamp': 'date here',
'timestamp': 'date here', # 'organization':'tm',
'organization':'tm'}, # 'seedtext':'not for self but for all'},
{'id': 1, # {'generated_motto': "not non-European not future body her sharing feel all fulfilled bring muse not face force World art black culture",
'generated_motto': "not non-European not future body her sharing feel all fulfilled bring muse not face force World art black culture", # 'timestamp': 'date here',
'timestamp': 'date here', # 'organization':'tm',
'organization':'tm'}, # 'seedtext':'not for self but for all'},
{'id': 2, # {'generated_motto': "neither contracts hate face coals words seriously become relationship different bourgeois turning attach feminists work participate about flirty fall",
'generated_motto': "neither contracts hate face coals words seriously become relationship different bourgeois turning attach feminists work participate about flirty fall", # 'timestamp': 'date here',
'timestamp': 'date here', # 'organization': 'tm',
'organization': 'tm'}, # 'seedtext':'not for self but for all'},
{'id': 3, # {'refusal_code': "401",
'refusal_code': "401", # 'refusal_message': "new desires, new modes of gender, and new struggles are breaking open",
'refusal_message': "new desires, new modes of gender, and new struggles are breaking open", # 'timestamp': 'date here',
'timestamp': 'date here', # 'organization': 'tm',
'organization': 'tm'} # 'seedtext':'not for self but for all'}
] # ]
# }
with open('static/files/slogans.json', 'r', encoding='utf8') as sloganjson:
slogans = json.load(sloganjson)
# slogans['data'].append(
# {'refusal_code': "401",
# 'refusal_message': "new desires, new modes of gender, and new struggles are breaking open",
# 'timestamp': 'date here',
# 'oganization': 'tm',
# 'seedtext':'not for self but for all'
# }
# )
# with open('static/files/slogans.json', 'w', encoding='utf8') as sloganjson:
# json.dump(slogans, sloganjson)
@app.route('/', methods=['GET']) @app.route('/', methods=['GET'])
@ -152,41 +102,74 @@ def home():
<p>A prototype API.</p>''' <p>A prototype API.</p>'''
@app.route('/queermottoAPI/r1/refusal', methods=['GET']) @app.route('/queermottoAPI/r1/refusal', methods=['GET'])
def api_args(): def api_args():
# Check if an ID was provided as part of the URL. buildDictElem = {}
# If ID is provided, assign it to a variable. buildDictElem['seedtext'] = 'not for self but for all'
# If no ID is provided, display an error in the browser. moment = datetime.datetime.now()
if 'rq' in request.args: buildDictElem['timestamp'] = moment.__str__()
rqstr = str(request.args['rq']) org = str(request.args['org'])
# org = str(request.args['org']) # buildDictElem['org']= org
if rqstr == "generate": count = 0
# Create an empty list for our results if count < 40:
results = [] # Check if an ID was provided as part of the URL.
# If ID is provided, assign it to a variable.
api_phrase = [] # If no ID is provided, display an error in the browser.
for i in range(len(seedTextList)): if 'rq' in request.args:
# Current word in the seed phrase rqstr = str(request.args['rq'])
current = seedTextList[i] if rqstr == "generate":
# Going through the letters in the above word # Create an empty list for our results
for y in range(len(current)): results = []
testKey = str(y) + current[y] api_phrase = []
# print(current[y],random.choice(toChooseFrom[testKey])) for i in range(len(seedTextList)):
api_phrase.append(random.choice(toChooseFrom[testKey])) # Current word in the seed phrase
api_phrase_str = ' '.join(api_phrase) current = seedTextList[i]
results.append(api_phrase_str) # Going through the letters in the above word
# print(api_phrase_str) for y in range(len(current)):
return jsonify(api_phrase_str) testKey = str(y) + current[y]
elif rqstr == "all_log": # print(current[y],random.choice(toChooseFrom[testKey]))
return jsonify(slogans) api_phrase.append(random.choice(toChooseFrom[testKey]))
elif rqstr == "success_log": api_phrase_str = ' \n '.join(api_phrase)
success_slogans = [] results.append(api_phrase_str)
for call in slogans:
if "refusal_code" not in call.keys(): for elem in refWords:
success_slogans.append(call) if elem in api_phrase:
return jsonify(success_slogans) count +=1
return jsonify(build_error_one())
# Check the date
moment = datetime.datetime.now()
if (moment.month==3 and moment.day==8) or (moment.month==5 and moment.day==1) or (moment.month==7 and moment.day==20):
count +=1
return jsonify(build_error_three())
count +=1
return jsonify(api_phrase_str)
elif rqstr == "all_log":
count +=1
return jsonify(slogans)
elif rqstr == "success_log":
success_slogans = []
for call in slogans:
if "refusal_code" not in call.keys():
success_slogans.append(call)
count +=1
return jsonify(success_slogans)
else:
count +=1
return jsonify(build_error_two())
else: else:
return "Error: No action field." count = 0
buildDictElem['refusal_code'] = 402
buildDictElem['refusal_message'] = build_error_three()
slogans['data'].append(buildDictElem)
with open('static/files/slogans.json', 'w', encoding='utf8') as sloganjson:
json.dump(slogans, sloganjson)
return jsonify(buildDictElem['refusal_message'])
# app.run() # app.run()

73
refusal_messages.py

@ -0,0 +1,73 @@
refusal_messages = [
"new desires, new modes of gender, and new struggles are breaking open",
"We need new words sufficient to speak both of the limits and potential of our time.",
"The collective self-determination of gender",
"Gender relations are not natural but historical — tied to cycles of accumulation and crisis and the political struggle against them.",
"The current gender regime is the index of a particular configuration of class power.",
"struggle will be the creation of new language and new concepts with which to grasp capitalist sexual and gender relations.",
"A Becoming Autonomous Zone (BAZ) of desirous mixings and recombinations; splicing female sexual liberation and autonomy with cyberfeminist skills, theory, embodiment, and political activism",
"A critical space of liberated social becoming and intellectual life",
"a space resistant to mono-culture in all its social, environmental, libidinal, political, and genetic forms.",
"A place of imaginative inertia that slows down the engines of corporate agro/biotech and allows time to assess its risks and benefits through long-term testing",
"To dream the dreams of another",
"To recite all the stories of the world",
"To be aware of all flights, their departure points and their arrival points",
"To invert the sexes",
"To know exactly how many times someone has cried",
"To invert hierarchies",
"we think feminism is still one of the few ideals we can hang on to in order not to be completely disillusioned by the state of the world today.",
"All we need is Action!",
"make a horizontal system in which we all express ourselves equally and freely",
"we seek for a better, equal system for all",
"Claim your place. ",
"Lead a double life. Be a split personality. Be two, three, four, five artists in one body",
"Be a hybrid",
"Complain, complain, complain. But be creative about it.",
"In order to create a more mutual and sustainable relationship with the Earth, we collaborate with nature.",
"Whether on farms, at sea, in the woods, or in small towns or large cities, we connect and empathize with nature.",
"eat code and die. Sucked in, down through a vortex of banality. You have just missed the twentieth century.",
"where code dictates pleasure and satisfies desire.",
"The pleasure's in the dematerialisation. The devolution of desire.",
"The limit is permission denied, vision doubled, and flesh necrotic.",
"The limit is NO CARRIER, the sudden shock of no contact, reaching out to touch but the skin is cold...",
"Endless confusion – endless pleasure!",
"Stop making sense.",
"Produce more noise.",
"Recognize that violence against queers can affect anyone.",
"The means of oppression of many groups intersect in ways that need to be analyzed and understood.",
"Find cracks at the margins of conservative and homogeneous social structures.",
"everyday you wake up alive, relatively happy, and a functioning human being, you are committing a rebellious act.",
"You as an alive and functioning queer are a revolutionary.",
"They are your enemy when they don't acknowledge your invisibility and continue to live in and contribute to a culture that kills you.",
"In cultured circles, queers may quietly coexist with an otherwise disapproving power elite.",
"Shouted.",
"Be proud. Do whatever you need to do to tear yourself away from your customary state of acceptance. Be free. Shout.",
"I hate that I grew up thinking I was the only queer in the world, and I hate even more that most queer kids still grow up the same way.",
"The right to be included belongs to everyone.",
"We have the right to move and the right to not be forced to move.",
"We witness how fear creates boundaries, how boundaries create hate and how hate only serves the oppressors.",
"cyberfeminism is not error 101",
"corrupting the discourse",
"Why aren’t the people in/of the Third World playing any significant role in the development of so-called international art?",
"Are we black people considered part of the society or merely looked down upon as immigrant workers?",
" We cannot expect the indigenous art to flourish under the imposing shadow of an alien culture and this shadow is not going to disappear until the tree of imperialism",
"Our art must therefore be oriented towards anti-imperialist struggle.",
"art must also wage struggle against domination and reactionary forces/ideas within its own sphere, without being discarded for political activity and without being separated from it.",
"Behind this facade of universality lay the desire to impose Western values on rest of the world.",
"The tools are often stories, retold stories, versions that reverse and displace the hierarchical dualisms of naturalized identities.",
"cyborg politics insist on noise and advocate pollution, rejoicing in the illegitimate fusions of animal and machine",
"machines can be prosthetic devices, intimate components, friendly selves.",
"Cyborg imagery can suggest a way out of the maze of dualisms in which we have explained our bodies and our tools to ourselves.",
"Black Power is not out to win the Civil Rights struggle, but to win the Human Rights struggle.",
"when was the last time you encountered a dominant piece of cultural production that really—really—took seriously the sense of queer life beyond tolerable (or routine) tokenism?",
"I want queer stories across the spectrum, up and down Brokeback Mountain and every other peak and valley.",
"Give back, give back, give back is ringing in my years, in my ears, in my year ears.",
"RENEW, RECOMMIT, RECONNECT in the vortex of freedom to be found in the collective queer imaginary!",
"We must take back the camera not simply to create our own stories but to prove that there are indeed other ways of being and knowing that challenge the notions of a pathological native",
"The normality kills me and we are ever so normal.",
"slice it up tear it up go baby go rip it up mix it up know baby know",
"Imagination, not formulaic narratives.",
"More laughter, less finger-wagging.",
"Stop nation building and start soul-searching!",
"Only soul power can help us survive a world where everything is blowing dry in the cosmic wind."
]

1
refused_words.py

@ -0,0 +1 @@
refWords = ["for", "a", "national", "lillian", "christian", "nationally", "john", "father", "religion"]

1
removed_words.py

@ -0,0 +1 @@
delWords = ["for", "a", "national", "lillian", "christian", "nationally", "john", "father", "religion"]

1
static/files/slogans.json

@ -0,0 +1 @@
{"description": "Description here", "source": "https://git.vvvvvvaria.org/ccl/queerAPI", "data": []}
Loading…
Cancel
Save