Pnut commited on
Commit
017dec1
1 Parent(s): a435e54

解决Bug(‘str’ object has no attribute ‘api_key’) (#589)

Browse files
Files changed (1) hide show
  1. modules/shared.py +3 -3
modules/shared.py CHANGED
@@ -41,11 +41,11 @@ class State:
41
  def switching_api_key(self, func):
42
  if not hasattr(self, "api_key_queue"):
43
  return func
44
-
45
  def wrapped(*args, **kwargs):
46
  api_key = self.api_key_queue.get()
47
- args = list(args)[1:]
48
- ret = func(api_key, *args, **kwargs)
49
  self.api_key_queue.put(api_key)
50
  return ret
51
 
 
41
  def switching_api_key(self, func):
42
  if not hasattr(self, "api_key_queue"):
43
  return func
44
+
45
  def wrapped(*args, **kwargs):
46
  api_key = self.api_key_queue.get()
47
+ args[0].api_key = api_key
48
+ ret = func(*args, **kwargs)
49
  self.api_key_queue.put(api_key)
50
  return ret
51