feedback_customer_query.py 3.08 KB
# -*- coding: utf-8 -*-
"""
@Time : 2021/8/3 9:11
@Auth : wlm
@File :test_feedback_customer_query.py
@IDE :PyCharm
"""

from commons import common as com
from commons.MySession import my,sy1

class feedback_customer_query():
    url = "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list.action"

    header = {
         "Host": "test.jmsf.diligrp.com:8385",
         "Connection": "keep-alive",
         "Content-Length": "0",
         "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
         "X-Requested-With": "XMLHttpRequest",
         "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
         "Accept-Language": "zh-CN,zh;q=0.9",
         "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list",
         "Accept-Encoding": "gzip,deflate",
         "Content-Type": "application/x-www-form-urlencoded",
    }

    body = '''rows=10&page=1&sort=id&order=desc&metadata[created]=[provider=datetimeProvider&index=10&field=created]
        &metadata[status]=[provider=stateProvider&index=20&field=status]
        &metadata[created] = {"provider": "datetimeProvider", "index": 10, "field": "created"}
        &metadata[status] = {"provider": "stateProvider", "index": 20, "field": "status"}
        &name=史芳&reatedStart=2021-08-02 00:00:00&createdEnd=2021-08-03 23:59:59'''




    # body = "rows=10&page=1&sort=id&order=desc&\
    #         metadata[created]=[provider=datetimeProvider&index=10&field=created]\
    #         &metadata[status]=[provider=stateProvider&index=20&field=status]\
    #         &name=史芳&reatedStart=2021-08-02 00:00:00&createdEnd=2021-08-03 23:59:59"
    # body = {
    #         "rows":"10",
    #         "page":"1",
    #         "sort":"id",
    #         "order":"desc",
    #         "metadata[created]": {"provider": "datetimeProvider", "index": 10, "field": "created"},
    #         "metadata[status]": {"provider": "stateProvider", "index": 20, "field": "status"},
    #         "name": "史芳",
    #         "createdStart":"2021-08-02 00:00:00",
    #         "createdEnd":"2021-08-03 23:59:59",
    # }
    # body = dict(body)
    # body["metadata[created]"] = json.dumps(body["metadata[created]"])
    # body["metadata[status]"] = json.dumps(body["metadata[status]"])


    # "metadata[created]": {"provider": "datetimeProvider", "index": 10, "field": "created"},
    # "metadata[status]": {"provider": "stateProvider", "index": 20, "field": "status"},
    # body = json.dumps(body).encode('utf-8')

    def __init__(self):
        self.url = feedback_customer_query.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
        self.header = feedback_customer_query.header
        self.body = feedback_customer_query.body
        # print(self.body)
# feedback_customer_query = urllib.parse.urlencode(feedback_customer_query())

# fcq = feedback_customer_query
# print(fcq.body)
# re = sy1.post(url = fcq.url, data = fcq.body.encode('utf-8'),headers = fcq.header,proxies=my.myproxies)
# print(re.text)