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
a |
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 pycurl | |
import re | |
from StringIO import StringIO | |
buffer = StringIO() | |
c = pycurl.Curl() | |
c.setopt(c.URL, 'https://x.com/api/store/search') | |
c.setopt(c.POST, True) | |
c.setopt(c.SSL_VERIFYPEER, False) | |
c.setopt(pycurl.HTTPHEADER, [ |
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 | |
headers = { | |
'Authorization': 'Basic YmVhdDpiZWF0X2FwcDswZWU4YTg0NjhmMmVjYjUzMzY2ZGM0MTA4NzUzZxxxxxxx', | |
'access-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJCRUFUIiwiaWF0IjoxNTA5MzI1Mzk3LCJ1c2VyX2lkIjoiNVNzUUFkcnhST1NhUlVwMzVRTlBhZ3lQcmsxekk3YXJ5U3kvRldvT0hkOD0iLCJhdWQiOiJCRUFUX0FQUCJ9.z2HKLAazfWZQysOg4gZ64T2nfT7xMjVfsgvQscHN-BM' | |
} | |
r = requests.post('https://x.com/api/store/search', json=[], headers=headers) | |
print(r.elapsed.total_seconds()) | |
print(r.headers) | |
print(r.json()) |
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
class WebRenderTemplateBase(RenderTemplateBase): | |
base_template_path = 'web' | |
def render(self): | |
return self._render_template() | |
def _render_template(self): | |
return render_template(self.template_path, **vars(self)) | |
class WebRenderCardViewTemplate(WebRenderTemplateBase): |
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
render_params.update(post_data) | |
return render_template('web.html', title=title, **render_params) |
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
render_params = {} | |
render_parmas['title'] = 'test_page' | |
.. | |
render_parmas['color'] = get_color_code(data) | |
return render_template('web.html', **render_params) |
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
return render_template('web.html', | |
title="test_page", | |
color=template['COLOR'], | |
ciurl=template['CIURL'], | |
itemname=template['ITEMNAME'], | |
amount=template['AMOUNT'], | |
name=template['NAME'], | |
duration=template['DURATION'], | |
cancelurl=template['CANCELURL'], | |
ad_banner=template['ADBANNER']) |
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
# -*- coding:utf-8 -*- | |
from tensorflow.examples.tutorials.mnist import input_data | |
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) | |
for key in ['train', 'test', 'validation']: | |
print("mnist.%s :" % key) | |
minst_dataset= getattr(mnist, key) | |
print("\tnum_examples : %d" % minst_dataset.num_examples) | |
print("\timages count : %d" % len(minst_dataset.images)) |
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
def configure_json_encoder(app): | |
from decimal import Decimal | |
class CustomJsonEncoder(json.JSONEncoder): | |
def default(self, obj): | |
if isinstance(obj, Decimal): | |
return str(obj) | |
if obj is None: | |
return str('') | |
return super(CustomJsonEncoder, self).default(obj) |
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
var audio_js = new Audio5js({ | |
ready: function () { | |
this.load('/pos_agent/static/audio/TableOrder_1.mp3'); | |
}, | |
play:function(){ | |
this.play(); | |
} | |
}); |
NewerOlder