我知道如何使用chrome hue查询。
我想使用Python查询。
我有色调帐号和密码。
问题:如何使用python查询?
def login_djangosite():
import requests
session = requests.Session()
next_url = "/"
login_url = "http://hue.bi.com/accounts/login/?next=/"
r = session.get(login_url)
form_data = dict(username=u'',password=u'',
csrfmiddlewaretoken=session.cookies['csrftoken'],next=next_url)
r = session.post(login_url, data=form_data, cookies=dict(), headers=dict(Referer=login_url))
# check if request executed successfully?
print(r.status_code)
cookies = session.cookies
headers = session.headers
response=session.get('http://hue.bi.hujiang.com/beeswax/#query',
cookies=session.cookies, headers=session.headers)
response.status_code
response.text
答案 0 :(得分:0)
使用python脚本通过Hue提交Hive查询,并将结果下载为csv文件。
在Hue 3.9上进行测试,应该适用于Hue 3。
Hue 4将编辑器名称0 libobjc.A.dylib 0x1b80c4090 objc_msgSend + 16
1 Foundation 0x1b875c4f0 probeGC + 120
2 Foundation 0x1b8672d64 -[NSConcreteMapTable rehashAround:] + 204
3 Foundation 0x1b8672c68 -[NSConcreteMapTable removeObjectForKey:] + 248
4 UIKitCore 0x1bc8c3484 _UIAnalyticsGatherMultitouchAnalytics + 632
5 UIKitCore 0x1bc43ea10 -[UIApplication sendEvent:] + 204
6 Instabug 0x103980274 __IBGSwizzle_sendEvent + 240
7 UIKitCore 0x1bc4b6c20 __dispatchPreprocessedEventFromEventQueue + 5880
8 UIKitCore 0x1bc4b917c __handleEventQueueInternal + 4924
9 UIKitCore 0x1bc4b1ff0 __handleHIDEventFetcherDrain + 108
10 CoreFoundation 0x1b831ea00 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
11 CoreFoundation 0x1b831e958 __CFRunLoopDoSource0 + 80
12 CoreFoundation 0x1b831e0f0 __CFRunLoopDoSources0 + 180
13 CoreFoundation 0x1b831923c __CFRunLoopRun + 1080
14 CoreFoundation 0x1b8318adc CFRunLoopRunSpecific + 464
15 GraphicsServices 0x1c22b9328 GSEventRunModal + 104
16 UIKitCore 0x1bc42663c UIApplicationMain + 1936
17 DocOn 0x100df8e10 main + 15 (main.m:15)
18 libdyld.dylib 0x1b81a2360 start + 4
更改为beeswax
,此脚本将无法正常工作,需要进行一些修改。
用法:
hive
脚本:
python pyhue.py -d database -s query.sql -o result.csv