简体   繁体   中英

Python request parameter unix timestamp

I'm trying to get the JSON response from this URL:

import time
from time import mktime
import requests
import json

header = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36'}

payload = {
           "jobCity":"null",
           "jobSkill":"null",
            "pageNumber":1,
            "userText":"",
           "jobTitleOrder":"null",
           "jobCityOrder":"null",
           "jobFunctionOrder":"null",
           "jobExperienceOrder":"null",
           "applyByOrder":"null",
           "regular":"true",
           "walkin":"true"
           }

response = requests.post(url="https://ibegin.tcs.com/iBegin/api/v1/jobs/searchJ?at=",headers=header,json=payload,params=str(long((time.time()) * 1000)))
json_obj = json.loads(response.text)
print json_obj

But the print result is empty :

 {u'message': u'Ok.', u'data': {u'jobs': [], u'totalJobs': 0}, u'result': u'Y'}

instead of this :

{"message":"Ok.","result":"Y","data":{"totalJobs":50,"jobs":[{"id":"120315J","jobTitle":"Python Developer ","location":"Singapore","functionName":"TECHNOLOGY","experience":"1-10","applyByDate":"27-APR-2018 11:59:59 PM","skills":"Python","walkin":"J","url":null},{"id":"120281J","jobTitle":"Java Developer","location":"Singapore","functionName":"TECHNOLOGY","experience":"3-8","applyByDate":"21-MAY-2018 11:59:59 PM","skills":"J2EE , Java","walkin":"J","url":null},{"id":"120280J","jobTitle":"Aws Tech Lead","location":"Singapore","functionName":"TECHNOLOGY","experience":"8-12","applyByDate":"30-APR-2018 11:59:59 PM","skills":"AWS redshift , Cloud AWS/Amazon","walkin":"J","url":null},{"id":"120277J","jobTitle":"Technical Support Executive","location":"Singapore","functionName":"IT INFRASTRUCTURE SERVICES","experience":"0-3","applyByDate":"30-APR-2018 11:59:59 PM","skills":"IT Infrastructure ","walkin":"J","url":null},{"id":"120276J","jobTitle":"Java Developer","location":"Singapore","functionName":"TECHNOLOGY","experience":"3-6","applyByDate":"30-APR-2018 11:59:59 PM","skills":"EJB , Weblogic Server , Java , JMS , Eclipse","walkin":"J","url":null},{"id":"120273J","jobTitle":"Aws Technical Lead","location":"Singapore","functionName":"TECHNOLOGY","experience":"5-10","applyByDate":"23-APR-2018 11:59:59 PM","skills":"AWS , AWS Deployment","walkin":"J","url":null},{"id":"120209J","jobTitle":"Sap Fico Consultant","location":"Singapore","functionName":"TECHNOLOGY","experience":"4-10","applyByDate":"18-APR-2018 11:59:59 PM","skills":"SAP FICO","walkin":"J","url":null},{"id":"120094J","jobTitle":"Apo Consultant","location":"Singapore","functionName":"TECHNOLOGY","experience":"8-10","applyByDate":"10-APR-2018 11:59:59 PM","skills":"SAP APO SNP , SAP APO","walkin":"J","url":null},{"id":"119352J","jobTitle":"Software Engineer (Java/J2ee)","location":"Singapore","functionName":"TECHNOLOGY","experience":"3-10","applyByDate":"31-MAR-2018 11:59:59 PM","skills":"J2EE , Angular JS , Java","walkin":"J","url":null},{"id":"119234J","jobTitle":"Ui Developer","location":"Singapore","functionName":"TECHNOLOGY","experience":"4-8","applyByDate":"01-MAY-2018 11:59:59 PM","skills":"Javascript , Node JS , TypeScript , BackboneJS , Angular JS , HTML","walkin":"J","url":null}]}}

Is there anything more I need to add to the request statement?

After running your code it seems there is nothing wrong with the code: You POSTed a requested and got no (job) results, nothing wrong with that. Perhaps tweeking the JSON parameters used for the POST request will produce some results

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM