daily pastebin goal


a guest Dec 12th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import re
  3. class Client:
  4.     # use regex for finding msid and token
  5.     def find(self, response, item=None):
  6.         if item == 'msid':
  7.             text = re.search(r'msid=([\w]*)&msname', response.text).group(1)
  8.         elif item == 'token':
  9.             text = re.search(r'token=([\w]*)&msid', response.text).group(1)
  10.         elif item is None:
  11.             raise ValueError('Please provide the items you want to find.')
  12.         else:
  13.             raise KeyError('The items you are looking for is not available.')
  14.         return text
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand