Junaidb commited on
Commit
e2580de
·
verified ·
1 Parent(s): 21dcb75

Update components/middleware.py

Browse files
Files changed (1) hide show
  1. components/middleware.py +4 -24
components/middleware.py CHANGED
@@ -11,13 +11,10 @@ import json
11
  import httpx
12
  from geopy.geocoders import Nominatim
13
  from geopy.exc import GeocoderServiceError
14
- from .mongodbconnection import provideClient
15
 
16
  geolocator = Nominatim(user_agent="velocity")
17
 
18
- dbclient=provideClient()
19
- db=dbclient["sdklogs_db"]
20
- coll=dbclient["sdklogs_col"]
21
 
22
 
23
 
@@ -240,18 +237,7 @@ class x401Kit(BaseHTTPMiddleware):
240
  print(tokenverify)
241
 
242
 
243
- sdkpayload={
244
-
245
- "signer":X_401_Addr,
246
- "challange":challange,
247
- "token_amount":mint_amount,
248
- "required_mint":required_mint,
249
- "sign_verification":signverify,
250
- "token_verification":tokenverify,
251
- "geo_code":geo_code,
252
- "restricted_loc":geo_code_locs
253
-
254
- }
255
 
256
  if signverify == True and tokenverify == True:
257
 
@@ -260,7 +246,7 @@ class x401Kit(BaseHTTPMiddleware):
260
 
261
  country=GEOCODER(coords)
262
  print(country)
263
- sdkpayload["geography"]=country
264
 
265
  if country["data"] is None:
266
  return JSONResponse(
@@ -285,13 +271,7 @@ class x401Kit(BaseHTTPMiddleware):
285
  status_code=401
286
  )
287
 
288
- coll.find_one_and_update(
289
- {"owner":"system"},
290
- {
291
- "$push":{
292
- "logs":sdkpayload
293
- }
294
- })
295
 
296
  response = await call_next(request)
297
 
 
11
  import httpx
12
  from geopy.geocoders import Nominatim
13
  from geopy.exc import GeocoderServiceError
 
14
 
15
  geolocator = Nominatim(user_agent="velocity")
16
 
17
+
 
 
18
 
19
 
20
 
 
237
  print(tokenverify)
238
 
239
 
240
+
 
 
 
 
 
 
 
 
 
 
 
241
 
242
  if signverify == True and tokenverify == True:
243
 
 
246
 
247
  country=GEOCODER(coords)
248
  print(country)
249
+
250
 
251
  if country["data"] is None:
252
  return JSONResponse(
 
271
  status_code=401
272
  )
273
 
274
+
 
 
 
 
 
 
275
 
276
  response = await call_next(request)
277