Created
August 11, 2017 12:31
-
-
Save farbod-s/9843ea21600e68f6f9a13a8d32487c7d to your computer and use it in GitHub Desktop.
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
# encoding=utf8 | |
import sys | |
import requests | |
import json | |
query = 'https://api.snapp.site/v2/passenger/price/s/1/96' | |
headers = { | |
'X-u': '{{X-u}}', | |
'X-h': '{{X-h}}', | |
'User-Agent': '{{USER_AGENT}}', | |
'Authorization': '{{YOUR_TOKEN}}', | |
'Content-Type': 'application/json; charset=utf-8', | |
'Host': 'api.snapp.site', | |
'Connection': 'Keep-Alive', | |
'Accept-Encoding': 'gzip', | |
'Content-Length': '245' | |
} | |
data = { | |
'origin_lat': '20.09566848788631', | |
'origin_lng': '60.022714234888554', | |
'destination_lat': '20.09259164075465', | |
'destination_lng': '60.01291914284229', | |
'service_type': '1', | |
'sub_service_type': '0', | |
'destination_place_id': '0', | |
'round_trip': 'false', | |
'services': 'false', | |
'tag': '1' | |
} | |
session = requests.session() | |
response = session.post(query, json=data, headers=headers) | |
response = response.json() | |
# print json.dumps(response) | |
print 'price is ' + str(response['data']['prices'][0]['final']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment