i = 0
def post_to_clojure():
try:
r = requests.post(config.uri)
print r.raw
except (RuntimeError, TypeError, NameError):
print "Error while query request"
@app.route('/start-timer', methods=['GET'])
def start_timer():
global i
i = 1
while i == 1:
post_to_clojure()
time.sleep(period)
@app.route('/stop-timer', methods=['GET'])
def stop_timer():
global i
i = 0
...
// для продакшен конфига
output: {
path: path.join(__dirname, 'production/public/'),
filename: 'bundle.js',
publicPath: '/',
},
...
// для dev конфига
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
...
...
.mac-bg {
background: url(/static/i/service/mac-bg.jpg) no-repeat;
background-size: cover;
}
...
function send_req($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$out = curl_exec($ch);
curl_close($ch);
return $out;
}
$url = "https://www.googleapis.com/youtube/v3/search?part=snippet&q=$keyword&type=video&maxResults=50&key=$api_token";
$res = json_decode(send_req($url));
echo "<pre>";
print_r($res);
echo "<hr>";
$pagetoken = $res->nextPageToken;
$url = "https://www.googleapis.com/youtube/v3/search?part=snippet&q=$keyword&type=video&maxResults=50&pageToken=$pagetoken&key=$api_token";
$res = json_decode(send_req($url));
print_r($res);
SELECT `g`.`id`, `g`.`name`, `g`.`description`, `g`.`price`, `i`.`images`
FROM `goods` AS `g`
LEFT JOIN (
SELECT `good_id`, GROUP_CONCAT(`link` SEPARATOR ',') AS `images`
FROM `images`
GROUP BY `good_id`
) AS `i` ON `i`.`good_id` = `g`.`id`
WHERE `g`.`id_category` = :category
ORDER BY `g`.`id` DESC;