Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- class Client:
- # use regex for finding msid and token
- def find(self, response, item=None):
- if item == 'msid':
- text = re.search(r'msid=([\w]*)&msname', response.text).group(1)
- elif item == 'token':
- text = re.search(r'token=([\w]*)&msid', response.text).group(1)
- elif item is None:
- raise ValueError('Please provide the items you want to find.')
- else:
- raise KeyError('The items you are looking for is not available.')
- return text
Add Comment
Please, Sign In to add comment