Skip to content

Commit

Permalink
fix: Send CSRF token
Browse files Browse the repository at this point in the history
The search endpoint asks for it.
  • Loading branch information
9ary authored and bb010g committed May 10, 2023
1 parent feb3ad6 commit 9f52444
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions twint/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,19 @@ def get_connector(config):

async def RequestUrl(config, init):
logme.debug(__name__ + ':RequestUrl')
csrf_token = random.randbytes(16).hex() # Looks like any random string works
_connector = get_connector(config)
_serialQuery = ""
params = []
cookies = {}
cookies = {
"ct0": csrf_token,
}
_url = ""
_headers = [("authorization", config.Bearer_token), ("x-guest-token", config.Guest_token)]
_headers = {
"authorization": config.Bearer_token,
"x-guest-token": config.Guest_token,
"x-csrf-token": csrf_token,
}

if config.Auth_token:
cookies["auth_token"] = config.Auth_token
Expand Down

0 comments on commit 9f52444

Please sign in to comment.