Last active
April 16, 2018 18:21
-
-
Save BlaayLock/06bc5d0235dc13490aae3f83e636907a to your computer and use it in GitHub Desktop.
pickpoint_api_python API PickPoint Welcome to pickpoint.ru API documentation Для модуль доставки PickPoint
This file contains hidden or 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
#! python2 | |
# //coding: utf-8 | |
# coding=utf-8 | |
''' | |
http://pickpoint.ru/sales/ | |
Тестовая версия https://e-solution.pickpoint.ru/apitest/ | |
Логин: apitest | |
Пароль: apitest | |
ИКН: 9990003041 | |
Рабочая версия https://e-solution.pickpoint.ru/api/ | |
''' | |
import json | |
import requests | |
session = requests.Session() | |
r = session.post('https://e-solution.pickpoint.ru/apitest/login', json={"Login": "apitest","Password": "apitest"}) | |
print r.status_code | |
try: | |
#~ print r.json()['SessionId'] | |
SessionId=r.json()['SessionId'] | |
except: | |
SessionId='' | |
#~ print type(r.json()) | |
#~ print r.text.encode('UTF-8').decode('UTF-8').encode('cp1251') | |
#~ print type(r.text) | |
#~ -------------------------------------------------------- | |
#~ r = requests.get('https://e-solution.pickpoint.ru/apitest/citylist', json={}) | |
#~ print r.status_code | |
#~ print type(r.text) | |
#~ print r.text.encode('UTF-8').decode('UTF-8').encode('cp1251') | |
#~ #~ lscity= type(r.json()) | |
#~ #~ lscity= type(r.text) | |
r = requests.get('https://e-solution.pickpoint.ru/apitest/postamatlist', json={}) | |
print r.status_code | |
#~ print type(r.text) | |
#~ print r.text.encode('UTF-8').decode('UTF-8').encode('cp1251') | |
#~ lscity= type(r.json()) | |
#~ lscity= type(r.text) | |
dxt = json.loads(r.text) | |
for response_native in dxt: | |
#~ print response_native['MapAllowed'] | |
Id=str(response_native['Id']) | |
OwnerId=str(response_native['OwnerId']) | |
CitiId=str(response_native['CitiId']) | |
CitiOwnerId=str(response_native['CitiOwnerId']) | |
CitiName=str(response_native['CitiName'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
Region=str(response_native['Region'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
CountryName=str(response_native['CountryName'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
Number=str(response_native['Number'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
Metro=str(response_native['Metro'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
MetroArray=str(response_native['MetroArray']) | |
Address=str(response_native['Address'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
House=str(response_native['House'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
PostCode=str(response_native['PostCode'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
Name=str(response_native['Name'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
WorkTime=str(response_native['WorkTime'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
Longitude=str(response_native['Longitude']) | |
#~ Status=str(response_native['Status']) | |
if (response_native['Status'])==1: | |
Status='Статус:Новый'.decode('UTF-8').encode('cp1251') | |
elif (response_native['Status'])==2: | |
Status='Статус:Рабочий'.decode('UTF-8').encode('cp1251') | |
elif (response_native['Status'])==3: | |
Status='Статус:Закрытый'.decode('UTF-8').encode('cp1251') | |
TypeTitle=str(response_native['TypeTitle'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
#~ Cash=str(response_native['Cash']) | |
if (response_native['Cash'])==True: Cash='возиожно оплата пластиковой картой'.decode('UTF-8').encode('cp1251') | |
else: Cash='нет опл.картой'.decode('UTF-8').encode('cp1251') | |
#~ Card=str(response_native['Card']) | |
if (response_native['Card'])==True: Card='оплата наличными'.decode('UTF-8').encode('cp1251') | |
else: Card='нет опл.нал.'.decode('UTF-8').encode('cp1251') | |
InDescription=str(response_native['InDescription'].encode('UTF-8').decode('UTF-8').encode('cp1251')).replace(';',',') | |
OutDescription=str(response_native['OutDescription'].encode('UTF-8').decode('UTF-8').encode('cp1251')).replace(';',',') | |
MaxSize=str(response_native['MaxSize'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
MaxWeight=str(response_native['MaxWeight'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
#~ WorkHourly=str(response_native['WorkHourly']) | |
if (response_native['WorkHourly'])==True: WorkHourly='работает круглосуточно'.decode('UTF-8').encode('cp1251') | |
else: WorkHourly='по расписанию дня'.decode('UTF-8').encode('cp1251') | |
#~ Opening=str(if response_native['Opening']=='True': 'Opening') | |
if (response_native['Opening'])==True: Opening='разрешено вскрытие'.decode('UTF-8').encode('cp1251') | |
else: Opening='без вскрытия'.decode('UTF-8').encode('cp1251') | |
#~ Returning=str(response_native['Returning']) | |
if (response_native['Returning'])==True: Returning='возможен возврат'.decode('UTF-8').encode('cp1251') | |
else: Returning='без возврата'.decode('UTF-8').encode('cp1251') | |
#~ Fitting=str(response_native['Fitting']) | |
if (response_native['Fitting'])==True: Fitting='возможна примерка'.decode('UTF-8').encode('cp1251') | |
LocationType=str(response_native['LocationType']) | |
try: | |
BuildingType=str(response_native['BuildingType'].encode('UTF-8').decode('UTF-8').encode('cp1251')).replace(';',',') | |
except: | |
BuildingType='' | |
try: | |
Comment=str(response_native['Comment'].encode('UTF-8').decode('UTF-8').encode('cp1251')) | |
except: | |
Comment='' | |
FileI0=str(response_native['FileI0']) | |
FileI1=str(response_native['FileI1']) | |
FileI2=str(response_native['FileI2']) | |
#~ :-) Please see type Boolean and Digit , e.g. ['Card']==True | |
print Id+';'+OwnerId+';'+CitiId+';'+CitiOwnerId+';'+CitiName+';'+Region+';'+CountryName+';'+Number+';'+Metro+';'+MetroArray+';'+Address+';'+House+';'+PostCode+';'+Name+';'+WorkTime+';'+Longitude+';'+Status+';'+TypeTitle+';'+Cash+';'+Card+';'+InDescription+';'+OutDescription+';'+MaxSize+';'+MaxWeight+';'+WorkHourly+';'+Opening+';'+Returning+';'+Fitting+';'+LocationType+';'+BuildingType+';'+Comment+';'+FileI0+';'+FileI1+';'+FileI2+';' | |
#~ -------------------------------------------------------- | |
r = session.post('https://e-solution.pickpoint.ru/apitest/logout', json={"Login": "apitest","Password": "apitest"}) | |
#~ print r.status_code | |
#~ print (r.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment