soiz commited on
Commit
f0625e8
·
verified ·
1 Parent(s): 7f18af8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -48
app.py CHANGED
@@ -1,54 +1,20 @@
1
- import os
2
- import time
3
- import subprocess
4
 
 
 
5
 
6
- subprocess.call("curl -fsSL https://get.docker.com -o get-docker.sh", shell=True)
7
- subprocess.call("sh get-docker.sh", shell=True)
8
- subprocess.call("wget https://github.com/vesoft-inc/nebula/releases/download/v3.3.0/nebula-3.3.0-ubuntu-amd64.deb", shell=True)
9
- subprocess.call("sudo dpkg -i nebula-3.3.0-ubuntu-amd64.deb", shell=True)
10
- # Nebula Graphサービスの起動
11
- subprocess.call("nebula-metad --daemon", shell=True)
12
- subprocess.call("nebula-storaged --daemon", shell=True)
13
- subprocess.call("nebula-graphd --daemon", shell=True)
14
 
 
 
15
 
16
- # サービスが起動するまでの遅延
17
- time.sleep(10) # 10秒待機(必要に応じて調整)
18
 
19
- from nebula3.Config import Config
20
- from nebula3.gclient.net import ConnectionPool
21
- from nebula3.mclient import MetaCache
22
- from nebula3.gclient.net import Connection
23
- from nebula3.graph import GraphService
24
 
25
- # 接続設定
26
- config = Config()
27
- config.max_connection_pool_size = 10
28
-
29
- # 接続プールの初期化
30
- connection_pool = ConnectionPool()
31
-
32
- # Nebula Graph に接続
33
- if not connection_pool.init([('127.0.0.1', 9669)], config):
34
- print("接続に失敗しました")
35
- exit(1)
36
-
37
- # セッションの取得
38
- session = connection_pool.get_session('username', 'password')
39
-
40
- # クエリの実行
41
- result_set = session.execute('SHOW SPACES')
42
-
43
- # 結果の表示
44
- if not result_set.is_succeeded():
45
- print(result_set.error_msg())
46
- else:
47
- for result in result_set.rows():
48
- print(result)
49
-
50
- # セッションを閉じる
51
- session.release()
52
-
53
- # 接続プールを閉じる
54
- connection_pool.close()
 
1
+ from selenium import webdriver
2
+ from selenium.webdriver.chrome.options import Options
 
3
 
4
+ # Chromeオプションの作成
5
+ chrome_options = Options()
6
 
7
+ # プロキシサーバーの設定
8
+ chrome_options.add_argument('--proxy-server=http://proxy.example.com:3128')
 
 
 
 
 
 
9
 
10
+ # WebDriverの作成
11
+ driver = webdriver.Chrome(options=chrome_options)
12
 
13
+ # Webページを開く
14
+ driver.get("https://httpbin.org/ip")
15
 
16
+ # レスポンスを表示
17
+ print(driver.page_source)
 
 
 
18
 
19
+ # ドライバーを閉じる
20
+ driver.quit()