Spaces:
Runtime error
Runtime error
Commit
·
0f25e87
1
Parent(s):
bfd867f
tried Api Forwarding
Browse files
app.py
CHANGED
@@ -131,27 +131,31 @@ else:
|
|
131 |
|
132 |
def infiniteScroll(cursor, query, searchMode, model):
|
133 |
global csrfTokenCookie
|
134 |
-
conn = http.client.HTTPSConnection("lexica.art")
|
135 |
print(query)
|
136 |
try:
|
137 |
cursor = int(cursor)
|
138 |
except:
|
139 |
cursor = 0
|
140 |
-
payload =
|
141 |
"text": query,
|
142 |
"searchMode": searchMode,
|
143 |
"source": "search",
|
144 |
"cursor": int(cursor),
|
145 |
"model": model
|
146 |
-
}
|
147 |
headers = {
|
148 |
'Content-Type': 'application/json',
|
149 |
'Cookie': '__Host-next-auth.csrf-token='+csrfTokenCookie+'; __Secure-next-auth.callback-url=https%3A%2F%2Flexica.art'
|
150 |
}
|
151 |
-
conn.request("POST", "/api/infinite-prompts", payload, headers)
|
152 |
-
res = conn.getresponse()
|
153 |
-
data = res.read()
|
154 |
-
|
|
|
|
|
|
|
|
|
155 |
|
156 |
|
157 |
@app.route('/infinite-prompts', methods=["POST", "GET"])
|
|
|
131 |
|
132 |
def infiniteScroll(cursor, query, searchMode, model):
|
133 |
global csrfTokenCookie
|
134 |
+
#conn = http.client.HTTPSConnection("lexica.art")
|
135 |
print(query)
|
136 |
try:
|
137 |
cursor = int(cursor)
|
138 |
except:
|
139 |
cursor = 0
|
140 |
+
payload = {
|
141 |
"text": query,
|
142 |
"searchMode": searchMode,
|
143 |
"source": "search",
|
144 |
"cursor": int(cursor),
|
145 |
"model": model
|
146 |
+
}
|
147 |
headers = {
|
148 |
'Content-Type': 'application/json',
|
149 |
'Cookie': '__Host-next-auth.csrf-token='+csrfTokenCookie+'; __Secure-next-auth.callback-url=https%3A%2F%2Flexica.art'
|
150 |
}
|
151 |
+
# conn.request("POST", "/api/infinite-prompts", payload, headers)
|
152 |
+
# res = conn.getresponse()
|
153 |
+
# data = res.read()
|
154 |
+
proxy = "http://b6cc19fa02905563b3f00d96357d94ac63247c60:@proxy.zenrows.com:8001"
|
155 |
+
proxies = {"http": proxy, "https": proxy}
|
156 |
+
response = requests.post("https://lexica.art/api/infinite-prompts",headers=headers, json=payload,proxies=proxies, verify=False)
|
157 |
+
#return json.loads(data.decode("utf-8"))
|
158 |
+
return json.loads(response.text)
|
159 |
|
160 |
|
161 |
@app.route('/infinite-prompts', methods=["POST", "GET"])
|