Skip to content

Instantly share code, notes, and snippets.

@k4ml
Created April 19, 2015 12:29
Show Gist options
  • Save k4ml/dad3b7bc74750d207924 to your computer and use it in GitHub Desktop.
Save k4ml/dad3b7bc74750d207924 to your computer and use it in GitHub Desktop.
import requests
base_url = 'https://gst.customs.gov.my/TAP'
s = requests.session()
# STEP 1
response = s.get('%s/GetWlbToken' % base_url)
print response.headers
token = response.headers['fast-ver-last']
# STEP 2
data = {
'Load': 1,
'FAST_VERLAST__': token,
}
response = s.get('%s/_/' % base_url, data=data)
token = response.headers['fast-ver-last']
print response.cookies
print response.content
# STEP 3
data = {
'DOC_MODAL_ID__': 0,
'EVENT__': 'b-i',
'FAST_VERLAST__': token,
}
response = s.post('%s/EventOccured' % base_url, data=data)
token = response.headers['fast-ver-last']
# STEP 4
data = {
'd-3': 'true', # gst number
'DOC_MODAL_ID__': 0,
}
response = s.post('https://gst.customs.gov.my/TAP/_/Recalc', data)
token = response.headers['fast-ver-last']
# STEP 5
data = {
#'d-5': '001784889344',
'd-5': '000176275456',
'FAST_VERLAST__': token,
'DOC_MODAL_ID__': 0,
}
response = s.post('https://gst.customs.gov.my/TAP/_/Recalc', data)
print response.headers
print response.content
import pdb;pdb.set_trace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment