Last active
August 23, 2023 09:31
-
-
Save mchayapol/03a0cb6b56b880b32232ddb9f88f5f6f to your computer and use it in GitHub Desktop.
ดึงข้อมูลผู้เสียภาษีด้วยเลขประจำตัวจาก WebService ของกรมสรรพากร
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests import Session | |
import zeep | |
from zeep import Client | |
from zeep.transports import Transport | |
import urllib3 | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
session = Session() | |
session.verify = False | |
transport = Transport(session=session) | |
client = Client('https://rdws.rd.go.th/serviceRD3/vatserviceRD3.asmx?wsdl', | |
transport=transport) | |
result = client.service.Service( | |
username='anonymous', | |
password='anonymous', | |
TIN='0105548115897', | |
ProvinceCode=0, | |
BranchNumber=0, | |
AmphurCode=9 | |
) | |
# Convert Zeep Response object (in this case Service) to Python dict. | |
result = zeep.helpers.serialize_object(result) | |
# print(result) | |
for k in result.keys(): | |
# print(k, result[k]) | |
if result[k] is not None: | |
v = result[k].get('anyType', None)[0] | |
print(k, v) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment