-
Snapp:
import snapp_cli snapp = snapp_cli.Snapp("YOURTOKEN") data = snapp.price(org_lat, org_lng, dst_lat, dst_lng)
for example:
snapp.price(36.74261805519854, 52.440780273541236, 36.74726736929079, 52.44548755036237)
-
Carpino:
import carpino_cli carpino = carpino_cli.Carpino() data = carpino.price(org_lat, org_lng, dst_lat, dst_lng)
for example:
carpino.price(36.74261805519854, 52.440780273541236, 36.74726736929079, 52.44548755036237)
-
Tap30:
import tap30_cli tap30 = tap30_cli.Tap30() data = tap30.price(org_lat, org_lng, dst_lat, dst_lng)
for example:
tap30.price(36.74261805519854, 52.440780273541236, 36.74726736929079, 52.44548755036237)
-
Google Maps:
import google_cli google = google_cli.GoogleMaps() data = google.directions(org_lat, org_lng, dst_lat, dst_lng)
for example:
google.directions(36.74261805519854, 52.440780273541236, 36.74726736929079, 52.44548755036237)
-
Netbarg:
import netbarg_cli netbarg = netbarg_cli.NetBarg("YOURTOKEN") data = netbarg.index_deals()
-
Carpino:
import tehranmap_cli tm = tehranmap_cli.TehranMap() data = tm.bus_stations(BusStationId)
for example:
tm.bus_stations(303)
Created
October 31, 2021 18:57
-
-
Save mrhalix/e532ff79dadd00a9e9d48c4f6e5fb41b to your computer and use it in GitHub Desktop.
# Iranian Map And Taxi Services APIs
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
import requests, json | |
class Carpino: | |
def __init__(self): | |
pass | |
def price(self, org_lat, org_lng, dest_lat, dest_lng): | |
cookies = {} | |
headers = { | |
'Authorization': 'Bearer eyJjdHkiOiJKV1QiLCJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..C8VYlbDlko521a7a.vaxGIHrj9BoiZynCZ4YuBjqrs3ecCmvSD2WNYTZHbuwNFPJ-HKhDO05qUKxu_QMjBXKyHvlc568vTO20Dor0FaUPwSB_dTlMKmpZfmNegm-x0C2eQotbloMf_KSLCoYXjVwBcON-BqjEIn_ggsaHOfoYbSAsiDNStUNoQuhNgwZRoMgSNNHgduA1-hKFgdTJsu1bNSbZG8O8XNjHYnOqo0f__jonmEErf0YdAqwU5p3GOjjtwxda4S88Q-sGSr6jEvxa4_iTD3ZiaR4XcdGUfB8O6WMQ0mWgZM02wzt1JdYs66con0ud2sfyjFELqqrb4VkMoip5diEZmx1qlHQF1Y7eZ4Q43WRZyPKhntX7q5L4TIL_AM7JiZUGFUal7vzPuM4lg7beh8luOryI3yrIo6k3Jlfpf7cZ9e5vYZeIGy3Xc9_zstcBIqml1KkjoMY6Riah3ALxf4kq-rnjxQtIPzhwvTgzG7rE-wO_ZsWh4hHTb-IKGcLuaAW6Nn-AH1ZNXxeRc7QzV0cZdmF8wdoNMu7mqVbR2BzqLbGH2A1tKH2kA3CgCdApARxlItM5KIJbillR95xE_BdgjsANhG5s.SeBwY6OaOC3oSd4rCOqmqQ', | |
'Accept-Language': 'fa', | |
'Connection': 'Keep-Alive', | |
'User-Agent': 'okhttp/3.6.0', | |
} | |
params = ( | |
('origin', str(org_lat) + ',' + str(org_lng)), | |
('destination', str(dest_lat) + ',' + str(dest_lng)), | |
('secondDestination', '0,0'), | |
('category', 'NORMAL'), | |
("rideType","SINGLE"), | |
("waitingTime","0"), | |
) | |
response = requests.get('http://api.carpino.info/v1/rides/quotation', headers=headers, params=params, cookies=cookies) | |
return json.loads(response.text) |
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
import requests, json | |
class GoogleMaps: | |
def __init__(self): | |
pass | |
def directions(self, org_lat, org_lng, dest_lat, dest_lng): | |
# http://maps.googleapis.com/maps/api/directions/json?origin=36.74261805519854,52.440780273541236&destination=36.74726736929079,52.44548755036237&sensor=false&units=metric&mode=driving&language=fa | |
url = "http://maps.googleapis.com/maps/api/directions/json?origin=" + str(org_lat) + ',' + str(org_lng) + "&destination=" + str(dest_lat) + ',' + str(dest_lng) + "&sensor=false&units=metric&mode=driving&language=fa" | |
headers = { | |
'Accept': 'application/json', | |
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36', | |
'Content-Type': 'application/json', | |
} | |
response = requests.post(url, headers=headers, verify=True) | |
return json.loads(response.text) |
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
import requests, json | |
class Snapp: | |
def __init__(self, auth): | |
self.auth = auth | |
def request_snp(self, url, headers, data): | |
proxies_l = open("proxies.json", 'r').read() | |
proxies_l = json.loads(proxies_l) | |
resp = False | |
for i in proxies_l: | |
print("selecting proxy:", i) | |
proxies = { | |
"https": i, | |
} | |
try: | |
# response = requests.post('https://web-api.snapp.ir/api/v1/ride/price', headers=headers, data=data, proxies=proxies, verify=True) | |
response = requests.post(url, headers=headers, data=data, proxies=proxies, verify=True) | |
resp = True | |
print("Works!") | |
break | |
except: | |
print("Error!\nChanging proxy...") | |
pass | |
try: | |
return json.loads(response.text) | |
except: | |
print("Error") | |
return {} | |
def price(self, org_lat, org_lng, dest_lat, dest_lng): | |
url = "https://web-api.snapp.ir/api/v1/ride/price" | |
headers = { | |
'Accept': 'application/json', | |
'Referer': 'https://app.snapp.ir/?utm_source=website&utm_medium=webapp-button', | |
'Origin': 'https://app.snapp.ir', | |
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36', | |
'Authorization': self.auth, | |
'Content-Type': 'application/json', | |
} | |
data = '{"origin_lat": ' + str(org_lat) + ',"origin_lng":' + str(org_lng) + ',"waiting":0,"round_trip":0,"destination_lat":' + str(dest_lat) + ',"destination_lng":' + str(dest_lng) + '}' | |
return self.request_snp(url, headers, data) |
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
import requests, json | |
class Tap30: | |
def __init__(self): | |
pass | |
def price(self, org_lat, org_lng, dest_lat, dest_lng): | |
cookies = {} | |
data = '{"origin":{"latitude":' + str(org_lat) + ',"longitude":' + str(org_lng) + '},"hasReturn":false,"destinations":[{"latitude":' + str(dest_lat) + ',"longitude":' + str(dest_lng) + '}]}' | |
content_len = len(str(data)) | |
headers = { | |
'x-authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoxNjI1MTA4LCJwcm9maWxlSWQiOjE2MjUxMDAsInVzZXJQYXNzQ3JlZGVudGlhbElkIjoxNTk2ODg3LCJpc0Nob3NlbkZvckluY2VudGl2ZSI6bnVsbCwiZGV2aWNlVG9rZW4iOiJkRkZMT19kMXhyVTpBUEE5MWJFNVVuLXhEUlJfWmJCY3BBZVJ0SnI2bnU3RjNnbExxdl9uSmJMZnVkOXA3T0dHX0tqUElkSzhlVFptQ0lsSUxIVzAtcV9acjJzelFVdi1BZXFZVk9uMmFXQzhWb3o4RmE0ZEVjSjNSdnVKbHVCMXk3UHBpLVVRSmVNNndRaGVwUmhCN2xRUyIsImRldmljZVR5cGUiOiJBTkRST0lEIiwicmVmZXJyYWxDb2RlIjoiVzA2SkNIIiwicmVmZXJyZXJJZCI6bnVsbCwicm9sZSI6IlBBU1NFTkdFUiIsImNyZWF0ZWRBdCI6IjIwMTctMDQtMDZUMTY6MTg6NTMuODk2WiIsInVwZGF0ZWRBdCI6IjIwMTgtMDEtMTVUMTM6MjI6MzIuMDk2WiIsInB1c2h5RGV2aWNlVG9rZW4iOm51bGwsInRlbGVncmFtSWQiOm51bGwsImZjbURldmljZVRva2VuIjoiZEZGTE9fZDF4clU6QVBBOTFiRTVVbi14RFJSX1piQmNwQWVSdEpyNm51N0YzZ2xMcXZfbkpiTGZ1ZDlwN09HR19LalBJZEs4ZVRabUNJbElMSFcwLXFfWnIyc3pRVXYtQWVxWVZPbjJhV0M4Vm96OEZhNGRFY0ozUnZ1Smx1QjF5N1BwaS1VUUplTTZ3UWhlcFJoQjdsUVMiLCJyZWdpc3RyYXRpb25Db21wbGV0ZSI6dHJ1ZSwiY2l0eSI6IlRFSFJBTiIsImFjY0ZyZWVJZCI6bnVsbCwicHJvZmlsZSI6eyJpZCI6MTYyNTEwMCwiZmlyc3ROYW1lIjoiYW1pbiIsImxhc3ROYW1lIjoiYWxlYWhtYWQiLCJpc01hbGUiOmZhbHNlLCJwaWN0dXJlSWQiOm51bGwsImJhbmtpbmdJbmZvSWQiOm51bGwsInJhdGUiOm51bGwsImVtYWlsIjoiYW1pbmFsZWFobWFkQHlhaG9vLmNvbSIsImNyZWF0ZWRBdCI6IjIwMTctMDQtMDZUMTY6MTg6NTMuOTAxWiIsInVwZGF0ZWRBdCI6IjIwMTgtMDEtMTZUMTE6MTE6MDcuMTIzWiIsImVtYWlsVmVyaWZpZWQiOm51bGwsInBob25lTnVtYmVyIjoiKzk4OTAyMDkwMjMzMyIsInNzbiI6bnVsbCwic2hvd1JhdGVBcHAiOmZhbHNlLCJjb25maXJtYXRpb25Db2RlIjoiMDQ3OTciLCJjb25maXJtYXRpb25WYWxpZCI6ZmFsc2UsImNvbmZpcm1hdGlvblRyeSI6MCwibGFuZ3VhZ2UiOm51bGwsInNlY29uZGFyeVBob25lTnVtYmVyIjpudWxsLCJyYXRpbmdDb3VudCI6MH0sInJlZ2lzdGVyZWQiOnRydWV9LCJpYXQiOjE1MTYxMDEwNjcsImF1ZCI6ImRvcm9zaGtlOmFwcCIsImlzcyI6ImRvcm9zaGtlOnNlcnZlciIsInN1YiI6ImRvcm9zaGtlOnRva2VuIn0.lC0_PstjH87myqaxrCJ2XP0svbCWFmDVS5o_cKykQ35O5AC4n1fM22Ph5tvFbCc7axR1KYUcsgVnh7uEYxH_rg', | |
'Accept-Language': 'FA', | |
'Connection': 'Keep-Alive', | |
'User-Agent': 'okhttp/3.6.0', | |
'Content-Type': 'application/json; charset=UTF-8', | |
'Content-Length': content_len, | |
'Accept-Encoding': "gzip" | |
} | |
response = requests.post('http://tap33.me/api/v2/ride/preview', headers=headers, json=data, cookies=cookies) | |
print(response) | |
return json.loads(response.text) |
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
import requests, json | |
class TehranMap: | |
def __init__(self): | |
pass | |
def bus_stations(self, bus_code): | |
cookies = { | |
'_ga': 'GA1.2.652670115.1515579173', | |
'_gid': 'GA1.2.1469142912.1515579173', | |
'AdVisited': 'true', | |
'_gat': '1', | |
} | |
headers = { | |
'Pragma': 'no-cache', | |
'Accept-Encoding': 'gzip, deflate', | |
'Accept-Language': 'en-US,en;q=0.9', | |
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36', | |
'Accept': 'application/json, text/javascript, */*; q=0.01', | |
'Referer': 'http://map.tehran.ir/', | |
'X-Requested-With': 'XMLHttpRequest', | |
'Connection': 'keep-alive', | |
'Cache-Control': 'no-cache', | |
} | |
params = ( | |
('id', bus_code), | |
('_', '1515579253060'), | |
) | |
response = requests.get('http://map.tehran.ir/infra/maps/bus-stations/route/info', headers=headers, params=params, cookies=cookies) | |
# response = requests.get('http://map.tehran.ir/infra/maps/bus-stations/route/info?id=303&_=1515579253060', headers=headers, cookies=cookies) | |
return json.loads(response.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment