14 lines
664 B
Python
14 lines
664 B
Python
import requests
|
|
|
|
url = 'https://metabase.ekeepa-dev.ir/api/session'
|
|
creds = {'username': 'Fallahi.hamed@gmail.com', 'password': 'r5kivS&JR4d2BfUaS95xCDY^NxX*'}
|
|
r = requests.post(url, json=creds, timeout=15)
|
|
token = r.json().get('id')
|
|
headers = {'X-Metabase-Session': token}
|
|
|
|
res = requests.post('https://metabase.ekeepa-dev.ir/api/dataset', headers=headers, json={
|
|
'database': 2,
|
|
'type': 'native',
|
|
'native': {'query': "SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND (table_name LIKE '%settle%' OR table_name LIKE '%pay%' OR table_name LIKE '%shaba%')"}
|
|
}, timeout=30)
|
|
print(res.json().get('data', {}).get('rows', []))
|