We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently a registry is used to store the cookies and some headers.
This is hard to read and maintain.
A much simpler solution is to keep cookies in file and read them like plain string.
def _load_headers(self): cookies = self.registry.get(Registry.Key.COOKIES) csrftoken = '' cookie_str = '' for c in cookies: if c.name == 'csrftoken': csrftoken = c.value cookie_str += c.name + '=' + c.value + '; ' cookie_str = cookie_str.strip() headers = { 'cookie': cookie_str, 'x-csrftoken': csrftoken, 'user-agent': AGENT_STRING } return headers
this is all the data we need to make requests
After this change all requests can be simplified to the following structure
options = { } data_obj = { 'options': options, 'context': {} } data = { 'source_url': '/pin/{}/'.format(pin_id), 'data': json.dumps(data_obj) } headers = self._load_headers() return requests.post(url=url, headers=headers, data=data)
The text was updated successfully, but these errors were encountered:
This is addressed in this PR:
#20
Sorry, something went wrong.
No branches or pull requests
Currently a registry is used to store the cookies and some headers.
This is hard to read and maintain.
A much simpler solution is to keep cookies in file and read them like plain string.
this is all the data we need to make requests
After this change all requests can be simplified to the following structure
The text was updated successfully, but these errors were encountered: