123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- # -*- coding: utf-8 -*-
- # !/usr/bin/env python
- import os, sys,time,datetime
- import urllib
- import requests
- from mongoengine import register_connection, PointField, DynamicDocument, StringField
- import simplejson as json
- from django.db.models.fields import DateTimeField
- PROJECT_ROOT = os.path.join(os.path.abspath(os.path.split(os.path.realpath(__file__))[0] + "/.."), '..')
- sys.path.insert(0, PROJECT_ROOT)
- os.environ.setdefault("DJANGO_SETTINGS_MODULE", "configs.testing")
- from script.base import init_env
- init_env(interactive = False)
- from apps.web.core.db import Searchable
- register_connection(alias = 'spider',
- name = 'spider',
- host = '116.62.228.194',
- port = 27017,
- username = 'dba',
- password = 'dayuan@2020..',
- authentication_source = 'admin')
- def get_shops_info(lat,lng):
- url = 'https://u.zhinengxiyifang.cn/api/Stores/findNearStoreInc'
- payload = {"lat":lat,"lont":lng,"skip":0,"limit":10}
- # url = 'https://www.baidu.com'
- # payload = {}
- proxies = {'http':'http://140.246.89.239:19382','https':'https://140.246.89.239:19382'}
- strhtml = requests.post(url, json = payload,proxies = proxies,timeout = 15).text
- result = json.loads(strhtml)
- return result
- # cookies = {
- # 'JSESSIONID':'0626C177663F8C8D0D18D212DB4EF04F',
- # 'AppName':'%u6C5F%u897F%u7F8E%u5929%u65B0%u80FD%u6E90%u79D1%u6280%u6709%u9650%u516C%u53F8'
- # }
- # url = 'https://1.yugu.net.cn/api/v1/agent/query_detail.htm' # 'https://1.yugu.net.cn/api/v1/agent/detail.htm'
- #
- # data = {'id':"327"}
- # strhtml = requests.post(url,json = data,headers = {'Authorization':'Bearer 2e8d745bae1e4a4561aacb2a4a733d9aade8'},verify=False,timeout = 15).text
- # result = json.loads(strhtml)
- # url = 'http://cdz.gpsserver.cn/ChargeCarSys?gtel=68000000423'
- # strhtml = requests.get(url,timeout = 15).text
- # result = json.loads(strhtml)
- # url = 'http://ydc.youdianchong.com:8087/newCloseCharger?longitude=112.85811&latitude=35.496819'
- # url = 'https://1.yugu.net.cn/api/v1/agent/query_detail.htm' # 'https://1.yugu.net.cn/api/v1/agent/detail.htm'
- #
- # data = {'id':"327"}
- # strhtml = requests.get(url,headers = {'openId':'ozk7Zv4WC5akrk9Lvrm78jggwHk4'},verify=False,timeout = 15).text
- # result = json.loads(strhtml)
- import base64
- import sys
- import json
- import base64
- # 打印文字
- print('aaa')
|