{"id":41275,"date":"2026-03-21T17:00:51","date_gmt":"2026-03-21T14:00:51","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/?p=41275"},"modified":"2026-03-21T17:00:51","modified_gmt":"2026-03-21T14:00:51","slug":"python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/","title":{"rendered":"Python 3&#8217;te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?"},"content":{"rendered":"<p><body><\/p>\n<h2>Python 3&#8217;te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in <code>subprocess<\/code> Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?<\/h2>\n<p>Python, g\u00fc\u00e7l\u00fc ve \u00e7ok y\u00f6nl\u00fc bir programlama dilidir ve sistem seviyesi g\u00f6revlerden web geli\u015ftirmeye kadar geni\u015f bir yelpazede kullan\u0131l\u0131r. \u00c7o\u011fu zaman, Python betiklerinizin yaln\u0131zca Python kodu \u00e7al\u0131\u015ft\u0131rmakla kalmay\u0131p, i\u015fletim sisteminde y\u00fckl\u00fc olan di\u011fer programlarla veya komutlarla da etkile\u015fime girmesi gerekebilir. \u00d6rne\u011fin, bir dosyay\u0131 s\u0131k\u0131\u015ft\u0131rmak i\u00e7in <code>zip<\/code> komutunu \u00e7a\u011f\u0131rmak, bir sistem servisini ba\u015flatmak veya durdurmak, bir veritaban\u0131 yede\u011fi almak i\u00e7in harici bir arac\u0131 kullanmak veya bir s\u00fcr\u00fcm kontrol sistemi (git gibi) ile etkile\u015fim kurmak isteyebilirsiniz. \u0130\u015fte bu noktada Python&#8217;\u0131n <code>subprocess<\/code> mod\u00fcl\u00fc devreye girer. Bu makale, Python 3&#8217;te <code>subprocess<\/code> mod\u00fcl\u00fcn\u00fc kullanarak harici programlar\u0131 g\u00fcvenli, verimli ve esnek bir \u015fekilde nas\u0131l \u00e7al\u0131\u015ft\u0131raca\u011f\u0131n\u0131z\u0131 derinlemesine inceleyecektir.<\/p>\n<h3>Giri\u015f: Neden <code>subprocess<\/code>?<\/h3>\n<p>Python&#8217;da harici komutlar\u0131 \u00e7al\u0131\u015ft\u0131rmak i\u00e7in tarihsel olarak farkl\u0131 y\u00f6ntemler bulunmaktayd\u0131. <code>os.system()<\/code> ve <code>os.popen()<\/code> gibi fonksiyonlar, basit durumlar i\u00e7in h\u0131zl\u0131 \u00e7\u00f6z\u00fcmler sunsa da, modern uygulamalar\u0131n ihtiya\u00e7 duydu\u011fu g\u00fcvenlik, kontrol ve esneklikten yoksundurlar. <code>subprocess<\/code> mod\u00fcl\u00fc, bu eksiklikleri gidermek ve harici programlarla etkile\u015fim i\u00e7in kapsaml\u0131 ve g\u00fc\u00e7l\u00fc bir aray\u00fcz sa\u011flamak amac\u0131yla tasarlanm\u0131\u015ft\u0131r.<\/p>\n<h4><code>os.system()<\/code> ve <code>os.popen()<\/code> Fonksiyonlar\u0131n\u0131n S\u0131n\u0131rl\u0131l\u0131klar\u0131<\/h4>\n<p><code>os.system(komut)<\/code> fonksiyonu, verilen komutu bir alt kabukta \u00e7al\u0131\u015ft\u0131r\u0131r ve yaln\u0131zca komutun d\u00f6n\u00fc\u015f kodunu (exit status) d\u00f6nd\u00fcr\u00fcr. \u00c7\u0131kt\u0131y\u0131 yakalamak veya hata durumlar\u0131n\u0131 ayr\u0131nt\u0131l\u0131 olarak ele almak m\u00fcmk\u00fcn de\u011fildir. Ayr\u0131ca, komutun do\u011frudan bir kabukta \u00e7al\u0131\u015ft\u0131r\u0131lmas\u0131, kabuk enjeksiyonu gibi g\u00fcvenlik a\u00e7\u0131klar\u0131na yol a\u00e7abilir, \u00f6zellikle kullan\u0131c\u0131dan al\u0131nan girdilerle komut olu\u015fturuluyorsa.<\/p>\n<p><code>os.popen(komut, mod)<\/code> ise komutun standart \u00e7\u0131kt\u0131s\u0131n\u0131 okumak i\u00e7in bir dosya benzeri nesne d\u00f6nd\u00fcr\u00fcr. Bu, \u00e7\u0131kt\u0131y\u0131 yakalama konusunda <code>os.system()<\/code>&#8216;den daha iyidir, ancak hala giri\u015f\/\u00e7\u0131k\u0131\u015f ak\u0131\u015flar\u0131n\u0131 tam olarak kontrol etme, hata ak\u0131\u015f\u0131n\u0131 (stderr) ayr\u0131 ayr\u0131 ele alma veya d\u00f6n\u00fc\u015f kodunu do\u011frudan alma gibi geli\u015fmi\u015f \u00f6zelliklerden yoksundur. G\u00fcvenlik endi\u015feleri de <code>os.system()<\/code> ile benzerdir.<\/p>\n<h4><code>subprocess<\/code> Mod\u00fcl\u00fcn\u00fcn Avantajlar\u0131<\/h4>\n<p><code>subprocess<\/code> mod\u00fcl\u00fc, yukar\u0131da bahsedilen eski y\u00f6ntemlerin t\u00fcm s\u0131n\u0131rlamalar\u0131n\u0131 a\u015far ve bir dizi \u00f6nemli avantaj sunar:<\/p>\n<p>*   <strong>Esneklik ve Kontrol:<\/strong> Harici program\u0131n standart giri\u015f (stdin), standart \u00e7\u0131k\u0131\u015f (stdout) ve standart hata (stderr) ak\u0131\u015flar\u0131n\u0131 ayr\u0131 ayr\u0131 kontrol edebilir, y\u00f6nlendirebilir ve yakalayabilirsiniz.<br \/>\n*   <strong>G\u00fcvenlik:<\/strong> Komut arg\u00fcmanlar\u0131n\u0131 liste olarak ge\u00e7erek kabuk enjeksiyonu riskini \u00f6nemli \u00f6l\u00e7\u00fcde azalt\u0131r. Varsay\u0131lan olarak bir kabuk kullanmadan do\u011frudan program\u0131 \u00e7al\u0131\u015ft\u0131r\u0131r.<br \/>\n*   <strong>Hata Y\u00f6netimi:<\/strong> Program\u0131n d\u00f6n\u00fc\u015f kodunu alabilir ve hata durumlar\u0131nda belirli istisnalar f\u0131rlatarak daha sa\u011flam hata y\u00f6netimi sa\u011flayabilirsiniz.<br \/>\n*   <strong>Asenkron \u00c7al\u0131\u015ft\u0131rma:<\/strong> Uzun s\u00fcren komutlar\u0131 arka planda \u00e7al\u0131\u015ft\u0131rabilir ve ana Python program\u0131n\u0131z\u0131n ak\u0131\u015f\u0131n\u0131 engellemeden onlarla etkile\u015fim kurabilirsiniz.<br \/>\n*   <strong>Geli\u015fmi\u015f \u00d6zellikler:<\/strong> \u00c7al\u0131\u015fma dizini de\u011fi\u015ftirme, ortam de\u011fi\u015fkenlerini ayarlama, zaman a\u015f\u0131m\u0131 belirleme ve borular (pipes) arac\u0131l\u0131\u011f\u0131yla birden fazla komutu ba\u011flama gibi geli\u015fmi\u015f yetenekler sunar.<\/p>\n<p>K\u0131sacas\u0131, <code>subprocess<\/code> mod\u00fcl\u00fc, Python&#8217;da harici programlarla etkile\u015fim kurman\u0131n modern, g\u00fcvenli ve tercih edilen yoludur.<\/p>\n<h3><code>subprocess<\/code> Mod\u00fcl\u00fcne Genel Bak\u0131\u015f<\/h3>\n<p><code>subprocess<\/code> mod\u00fcl\u00fc, \u00e7e\u015fitli seviyelerde kontrol sa\u011flayan farkl\u0131 fonksiyonlar sunar. En basitinden en karma\u015f\u0131\u011f\u0131na do\u011fru ilerleyecek olursak:<\/p>\n<p>*   <strong><code>subprocess.run()<\/code>:<\/strong> Python 3.5 ve sonraki s\u00fcr\u00fcmlerde tan\u0131t\u0131lan ve \u00e7o\u011fu kullan\u0131m durumu i\u00e7in \u00f6nerilen y\u00fcksek seviyeli bir fonksiyon. Bir komutu \u00e7al\u0131\u015ft\u0131r\u0131r, tamamlanmas\u0131n\u0131 bekler ve <code>CompletedProcess<\/code> nesnesi d\u00f6nd\u00fcr\u00fcr.<br \/>\n*   <strong><code>subprocess.call()<\/code>:<\/strong> Bir komutu \u00e7al\u0131\u015ft\u0131r\u0131r, tamamlanmas\u0131n\u0131 bekler ve d\u00f6n\u00fc\u015f kodunu d\u00f6nd\u00fcr\u00fcr. \u00c7\u0131kt\u0131y\u0131 yakalamaz.<br \/>\n*   <strong><code>subprocess.check_call()<\/code>:<\/strong> <code>call()<\/code> gibi \u00e7al\u0131\u015f\u0131r ancak d\u00f6n\u00fc\u015f kodu s\u0131f\u0131r de\u011filse (yani bir hata olu\u015ftuysa) <code>CalledProcessError<\/code> istisnas\u0131 f\u0131rlat\u0131r.<br \/>\n*   <strong><code>subprocess.check_output()<\/code>:<\/strong> Bir komutu \u00e7al\u0131\u015ft\u0131r\u0131r, \u00e7\u0131kt\u0131s\u0131n\u0131 yakalar ve d\u00f6nd\u00fcr\u00fcr. D\u00f6n\u00fc\u015f kodu s\u0131f\u0131r de\u011filse <code>CalledProcessError<\/code> f\u0131rlat\u0131r.<br \/>\n*   <strong><code>subprocess.Popen<\/code> s\u0131n\u0131f\u0131:<\/strong> Mod\u00fcl\u00fcn temelini olu\u015fturan d\u00fc\u015f\u00fck seviyeli aray\u00fcz. Daha karma\u015f\u0131k senaryolar (asenkron i\u015flemler, \u00f6zel boru yap\u0131land\u0131rmalar\u0131 vb.) i\u00e7in do\u011frudan kullan\u0131ma uygundur.<\/p>\n<p>Bu fonksiyonlar aras\u0131nda en \u00e7ok kullan\u0131lan ve \u00f6nerilen <code>subprocess.run()<\/code> fonksiyonudur.<\/p>\n<h4><code>subprocess.run()<\/code>: Modern ve Tercih Edilen Yakla\u015f\u0131m<\/h4>\n<p><code>subprocess.run()<\/code> fonksiyonu, basit komut \u00e7al\u0131\u015ft\u0131rmadan karma\u015f\u0131k ak\u0131\u015f kontrol\u00fcne kadar bir\u00e7ok ihtiyac\u0131 kar\u015f\u0131lamak \u00fczere tasarlanm\u0131\u015ft\u0131r. Bir komutu \u00e7al\u0131\u015ft\u0131r\u0131r, komutun tamamlanmas\u0131n\u0131 bekler ve komutun d\u00f6n\u00fc\u015f kodunu, standart \u00e7\u0131kt\u0131s\u0131n\u0131 ve standart hatas\u0131n\u0131 i\u00e7eren bir <code>CompletedProcess<\/code> nesnesi d\u00f6nd\u00fcr\u00fcr.<\/p>\n<p>Fonksiyonun temel yap\u0131s\u0131 \u015f\u00f6yledir:<br \/>\n<code>subprocess.run(args, <em>, stdin=None, input=None, stdout=None, stderr=None, capture_output=False, shell=False, cwd=None, timeout=None, check=False, encoding=None, errors=None, text=None, env=None, universal_newlines=None, <\/em>*other_popen_kwargs)<\/code><\/p>\n<p>Bir\u00e7ok parametresi olsa da, \u00e7o\u011fu durumda yaln\u0131zca birka\u00e7 tanesini kullan\u0131r\u0131z.<\/p>\n<h3><code>subprocess.run()<\/code> Kullan\u0131m\u0131 Derinlemesine<\/h3>\n<p>\u015eimdi <code>subprocess.run()<\/code> fonksiyonunun temel kullan\u0131m senaryolar\u0131n\u0131 ve \u00f6nemli parametrelerini \u00f6rneklerle inceleyelim.<\/p>\n<h4>Basit Komut \u00c7al\u0131\u015ft\u0131rma<\/h4>\n<p>En temel kullan\u0131m, bir komutu \u00e7al\u0131\u015ft\u0131rmak ve tamamlanmas\u0131n\u0131 beklemektir. Komutu bir liste olarak ge\u00e7mek, g\u00fcvenlik a\u00e7\u0131s\u0131ndan en iyi uygulamad\u0131r. Her liste \u00f6\u011fesi, komutun bir b\u00f6l\u00fcm\u00fcn\u00fc veya bir arg\u00fcman\u0131n\u0131 temsil eder.<\/p>\n<pre><code class=\"language-python\">import subprocess\n\n<h2>Linux\/macOS i\u00e7in: mevcut dizindeki dosyalar\u0131 listele<\/h2>\ntry:\n    result = subprocess.run(['ls', '-l'], capture_output=True, text=True, check=True)\n    print(\"Komut ba\u015far\u0131yla \u00e7al\u0131\u015ft\u0131.\")\n    print(\"\u00c7\u0131kt\u0131:\\n\", result.stdout)\nexcept subprocess.CalledProcessError as e:\n    print(f\"Hata olu\u015ftu: {e}\")\n    print(\"Hata \u00e7\u0131kt\u0131s\u0131:\\n\", e.stderr)\nexcept FileNotFoundError:\n    print(\"Komut bulunamad\u0131. (\u00d6rn: 'ls' yerine 'dir' kullanman\u0131z gerekebilir.)\")\n\n<h2>Windows i\u00e7in (genellikle 'dir' komutu kullan\u0131l\u0131r)<\/h2>\ntry:\n    result = subprocess.run(['dir'], capture_output=True, text=True, check=True, shell=True) # Windows'ta 'dir' genellikle shell gerektirir\n    print(\"\\nWindows komutu ba\u015far\u0131yla \u00e7al\u0131\u015ft\u0131.\")\n    print(\"\u00c7\u0131kt\u0131:\\n\", result.stdout)\nexcept subprocess.CalledProcessError as e:\n    print(f\"Hata olu\u015ftu: {e}\")\n    print(\"Hata \u00e7\u0131kt\u0131s\u0131:\\n\", e.stderr)\nexcept FileNotFoundError:\n    print(\"Komut bulunamad\u0131.\")<\/code><\/pre>\n<p>Yukar\u0131daki \u00f6rnekte <code>['ls', '-l']<\/code> veya <code>['dir']<\/code> listesi, \u00e7al\u0131\u015ft\u0131r\u0131lacak program\u0131 ve arg\u00fcmanlar\u0131n\u0131 belirtir. Program\u0131n kendisi (\u00f6rne\u011fin <code>ls<\/code>) ilk \u00f6\u011fe olmal\u0131d\u0131r.<\/p>\n<h4>\u00c7\u0131kt\u0131y\u0131 Yakalama<\/h4>\n<p>Harici bir program\u0131n standart \u00e7\u0131kt\u0131s\u0131n\u0131 (stdout) ve standart hatas\u0131n\u0131 (stderr) yakalamak, genellikle en \u00f6nemli ihtiya\u00e7lardan biridir. Bunu <code>capture_output=True<\/code> parametresiyle yapabiliriz. \u00c7\u0131kt\u0131n\u0131n metin olarak i\u015flenmesini istiyorsak <code>text=True<\/code> (veya Python 3.7 \u00f6ncesi <code>universal_newlines=True<\/code>) kullan\u0131r\u0131z; aksi takdirde bayt dizileri olarak d\u00f6ner.<\/p>\n<pre><code class=\"language-python\">import subprocess\n\ntry:\n    # 'capture_output=True' stdout ve stderr'i yakalar\n    # 'text=True' \u00e7\u0131kt\u0131y\u0131 metin olarak decode eder (varsay\u0131lan UTF-8)\n    result = subprocess.run(['ping', '-c', '4', 'google.com'], capture_output=True, text=True, check=True)\n    \n    print(\"D\u00f6n\u00fc\u015f Kodu:\", result.returncode)\n    print(\"Standart \u00c7\u0131kt\u0131:\\n\", result.stdout)\n    print(\"Standart Hata:\\n\", result.stderr) # Genellikle bo\u015f olur e\u011fer hata yoksa\n\nexcept subprocess.CalledProcessError as e:\n    print(f\"Ping komutu hata ile sonu\u00e7land\u0131: {e}\")\n    print(\"D\u00f6n\u00fc\u015f Kodu:\", e.returncode)\n    print(\"Standart \u00c7\u0131kt\u0131:\\n\", e.stdout)\n    print(\"Standart Hata:\\n\", e.stderr)\nexcept FileNotFoundError:\n    print(\"Ping komutu bulunamad\u0131. (Windows'ta '-n' kullanman\u0131z gerekebilir.)\")<\/code><\/pre>\n<p><code>result<\/code> nesnesi, <code>CompletedProcess<\/code> tipindedir ve \u015fu \u00f6nemli niteliklere sahiptir:<br \/>\n*   <code>returncode<\/code>: Program\u0131n d\u00f6n\u00fc\u015f kodu (genellikle ba\u015far\u0131 i\u00e7in 0, hata i\u00e7in ba\u015fka bir de\u011fer).<br \/>\n*   <code>stdout<\/code>: Program\u0131n standart \u00e7\u0131kt\u0131s\u0131 (bayt dizisi veya <code>text=True<\/code> ile metin).<br \/>\n*   <code>stderr<\/code>: Program\u0131n standart hata \u00e7\u0131kt\u0131s\u0131 (bayt dizisi veya <code>text=True<\/code> ile metin).<\/p>\n<h4>Hatalar\u0131 Y\u00f6netme<\/h4>\n<p>Bir program\u0131n ba\u015far\u0131yla tamamlan\u0131p tamamlanmad\u0131\u011f\u0131n\u0131 anlamak i\u00e7in d\u00f6n\u00fc\u015f kodunu kontrol etmek \u00f6nemlidir. <code>check=True<\/code> parametresi, d\u00f6n\u00fc\u015f kodu s\u0131f\u0131rdan farkl\u0131 oldu\u011funda (yani bir hata olu\u015ftu\u011funda) <code>CalledProcessError<\/code> istisnas\u0131 f\u0131rlat\u0131lmas\u0131n\u0131 sa\u011flar. Bu, hata y\u00f6netimini \u00e7ok daha kolayla\u015ft\u0131r\u0131r.<\/p>\n<pre><code class=\"language-python\">import subprocess\n\n<h2>Hatal\u0131 bir komut \u00e7al\u0131\u015ft\u0131rma \u00f6rne\u011fi (olmayan bir dosya)<\/h2>\ntry:\n    result = subprocess.run(['cat', 'olmayan_dosya.txt'], capture_output=True, text=True, check=True)\n    print(\"Komut ba\u015far\u0131yla \u00e7al\u0131\u015ft\u0131.\")\n    print(\"\u00c7\u0131kt\u0131:\\n\", result.stdout)\nexcept subprocess.CalledProcessError as e:\n    print(f\"Hata olu\u015ftu: {e}\")\n    print(f\"D\u00f6n\u00fc\u015f Kodu: {e.returncode}\")\n    print(\"Standart \u00c7\u0131kt\u0131 (stdout):\\n\", e.stdout)\n    print(\"Standart Hata (stderr):\\n\", e.stderr)\nexcept FileNotFoundError:\n    print(\"Komut bulunamad\u0131.\")<\/code><\/pre>\n<p><code>CalledProcessError<\/code> istisnas\u0131, ba\u015far\u0131s\u0131z olan komut hakk\u0131nda <code>returncode<\/code>, <code>cmd<\/code>, <code>stdout<\/code> ve <code>stderr<\/code> gibi bilgileri i\u00e7erir.<\/p>\n<h4>Girdi Sa\u011flama (<code>input<\/code>)<\/h4>\n<p>Baz\u0131 programlar standart girdiden (stdin) veri okumay\u0131 bekler. <code>subprocess.run()<\/code> fonksiyonunun <code>input<\/code> parametresi ile bu veriyi sa\u011flayabiliriz. <code>input<\/code> parametresi bir bayt dizisi veya <code>text=True<\/code> ile bir metin dizesi alabilir.<\/p>\n<pre><code class=\"language-python\">import subprocess\n\n<h2>'grep' komutuna girdi sa\u011flamak<\/h2>\ndata_to_pipe = \"apple\\nbanana\\norange\\ngrape\\napple pie\"\n\ntry:\n    # 'input' parametresi stdin'e g\u00f6nderilecek veriyi sa\u011flar\n    # 'text=True' input'u ve \u00e7\u0131kt\u0131y\u0131 metin olarak i\u015fler\n    result = subprocess.run(\n        ['grep', 'apple'],\n        input=data_to_pipe,\n        capture_output=True,\n        text=True,\n        check=True\n    )\n    print(\"Grep \u00e7\u0131kt\u0131s\u0131:\\n\", result.stdout)\nexcept subprocess.CalledProcessError as e:\n    print(f\"Grep komutu hata ile sonu\u00e7land\u0131: {e}\")\n    print(\"Hata \u00e7\u0131kt\u0131s\u0131:\\n\", e.stderr)\nexcept FileNotFoundError:\n    print(\"Grep komutu bulunamad\u0131.\")<\/code><\/pre>\n<h4>Kabuk Kullan\u0131m\u0131 (<code>shell=True<\/code>)<\/h4>\n<p><code>shell=True<\/code> parametresi, komutun bir kabuk arac\u0131l\u0131\u011f\u0131yla \u00e7al\u0131\u015ft\u0131r\u0131lmas\u0131n\u0131 sa\u011flar. Bu, kabu\u011fun \u00f6zelliklerinden (\u00f6rn. borular <code>|<\/code>, y\u00f6nlendirmeler <code>><\/code>, joker karakterler <code>*<\/code>) yararlanmak istedi\u011finizde kullan\u0131\u015fl\u0131 olabilir. Ancak, g\u00fcvenlik riskleri ta\u015f\u0131d\u0131\u011f\u0131 i\u00e7in dikkatli kullan\u0131lmal\u0131d\u0131r. \u00d6zellikle kullan\u0131c\u0131dan gelen girdilerle komut olu\u015fturuluyorsa, kabuk enjeksiyonu riski vard\u0131r.<\/p>\n<pre><code class=\"language-python\">import subprocess\n\n<h2>Kabuk kullanarak birden fazla komutu ba\u011flama<\/h2>\n<h2>D\u0130KKAT: shell=True g\u00fcvenlik riski ta\u015f\u0131yabilir!<\/h2>\ntry:\n    # 'ls -l | grep python' komutunu \u00e7al\u0131\u015ft\u0131r\n    result = subprocess.run(\n        'ls -l | grep python',\n        capture_output=True,\n        text=True,\n        shell=True, # Kabuk kullan\u0131l\u0131yor\n        check=True\n    )\n    print(\"Kabuk komutunun \u00e7\u0131kt\u0131s\u0131:\\n\", result.stdout)\nexcept subprocess.CalledProcessError as e:\n    print(f\"Kabuk komutu hata ile sonu\u00e7land\u0131: {e}\")\n    print(\"Hata \u00e7\u0131kt\u0131s\u0131:\\n\", e.stderr)\nexcept FileNotFoundError:\n    print(\"Komut veya kabuk bulunamad\u0131.\")<\/code><\/pre>\n<p><code>shell=True<\/code> kullan\u0131ld\u0131\u011f\u0131nda, <code>args<\/code> parametresi tek bir dize olarak ge\u00e7irilmelidir, bir liste olarak de\u011fil. M\u00fcmk\u00fcn oldu\u011funca <code>shell=False<\/code> kullanmaya ve arg\u00fcmanlar\u0131 liste olarak ge\u00e7meye \u00f6zen g\u00f6sterin.<\/p>\n<h4>\u00c7al\u0131\u015fma Dizini ve Ortam De\u011fi\u015fkenleri (<code>cwd<\/code>, <code>env<\/code>)<\/h4>\n<p>Bir komutun belirli bir \u00e7al\u0131\u015fma dizininde (Current Working Directory) \u00e7al\u0131\u015fmas\u0131n\u0131 veya belirli ortam de\u011fi\u015fkenleriyle \u00e7al\u0131\u015fmas\u0131n\u0131 isteyebilirsiniz.<\/p>\n<p>*   <code>cwd<\/code>: Komutun \u00e7al\u0131\u015faca\u011f\u0131 dizini belirtir.<br \/>\n*   <code>env<\/code>: Komut i\u00e7in \u00f6zel ortam de\u011fi\u015fkenlerini i\u00e7eren bir s\u00f6zl\u00fck. E\u011fer <code>env<\/code> belirtilirse, mevcut ortam de\u011fi\u015fkenleri yerine bu s\u00f6zl\u00fck kullan\u0131l\u0131r. Mevcut ortam de\u011fi\u015fkenlerini koruyup \u00fczerine ekleme yapmak isterseniz, <code>os.environ.copy()<\/code> ile mevcut ortam\u0131 kopyalay\u0131p de\u011fi\u015fiklik yapmal\u0131s\u0131n\u0131z.<\/p>\n<pre><code class=\"language-python\">import subprocess\nimport os\n\n<h2>Belirli bir dizinde komut \u00e7al\u0131\u015ft\u0131rma<\/h2>\ntry:\n    # Ge\u00e7ici bir dizin olu\u015ftur\n    os.makedirs(\"temp_dir\", exist_ok=True)\n    with open(\"temp_dir\/test.txt\", \"w\") as f:\n        f.write(\"Hello from temp_dir\")\n\n    print(\"\\n'temp_dir' i\u00e7inde 'ls' \u00e7al\u0131\u015ft\u0131rma:\")\n    result = subprocess.run(\n        ['ls', '-l'],\n        cwd=\"temp_dir\", # Komutu temp_dir i\u00e7inde \u00e7al\u0131\u015ft\u0131r\n        capture_output=True,\n        text=True,\n        check=True\n    )\n    print(result.stdout)\nexcept Exception as e:\n    print(f\"Dizin i\u00e7inde komut \u00e7al\u0131\u015ft\u0131rma hatas\u0131: {e}\")\nfinally:\n    # Ge\u00e7ici dizini temizle\n    if os.path.exists(\"temp_dir\"):\n        os.remove(\"temp_dir\/test.txt\")\n        os.rmdir(\"temp_dir\")\n\n\n<h2>Ortam de\u011fi\u015fkenleriyle komut \u00e7al\u0131\u015ft\u0131rma<\/h2>\nmy_env = os.environ.copy() # Mevcut ortam de\u011fi\u015fkenlerini kopyala\nmy_env[\"MY_VARIABLE\"] = \"PythonSubprocess\"\nmy_env[\"ANOTHER_VAR\"] = \"TestValue\"\n\ntry:\n    # Linux\/macOS i\u00e7in 'env' komutu veya Windows i\u00e7in 'set'\n    print(\"\\nOrtam de\u011fi\u015fkenleriyle 'env' \u00e7al\u0131\u015ft\u0131rma:\")\n    result = subprocess.run(\n        ['env'], # veya Windows i\u00e7in ['cmd', '\/c', 'set']\n        env=my_env, # \u00d6zel ortam de\u011fi\u015fkenlerini kullan\n        capture_output=True,\n        text=True,\n        check=True\n    )\n    print(result.stdout)\n    # Kontrol edelim\n    if \"MY_VARIABLE=PythonSubprocess\" in result.stdout:\n        print(\"MY_VARIABLE ba\u015far\u0131yla ayarland\u0131.\")\nexcept Exception as e:\n    print(f\"Ortam de\u011fi\u015fkenleriyle komut \u00e7al\u0131\u015ft\u0131rma hatas\u0131: {e}\")<\/code><\/pre>\n<h4>Zaman A\u015f\u0131m\u0131 (<code>timeout<\/code>)<\/h4>\n<p>Bir komutun \u00e7ok uzun s\u00fcre \u00e7al\u0131\u015fmas\u0131n\u0131 engellemek i\u00e7in <code>timeout<\/code> parametresini kullanabilirsiniz. Belirtilen saniye cinsinden s\u00fcre doldu\u011funda, <code>TimeoutExpired<\/code> istisnas\u0131 f\u0131rlat\u0131l\u0131r.<\/p>\n<pre><code class=\"language-python\">import subprocess\nimport time\n\ntry:\n    print(\"\\n5 saniye zaman a\u015f\u0131m\u0131 ile 'sleep 10' \u00e7al\u0131\u015ft\u0131rma:\")\n    # 'sleep 10' komutu 10 saniye uyur, ancak biz 5 saniye zaman a\u015f\u0131m\u0131 veriyoruz\n    result = subprocess.run(\n        ['sleep', '10'], # Windows i\u00e7in 'timeout \/t 10' veya 'ping 127.0.0.1 -n 11 > nul'\n        timeout=5,\n        capture_output=True,\n        text=True\n    )\n    print(\"Komut ba\u015far\u0131yla tamamland\u0131 (zaman a\u015f\u0131m\u0131 beklenmiyordu).\")\n    print(result.stdout)\nexcept subprocess.TimeoutExpired as e:\n    print(f\"Komut zaman a\u015f\u0131m\u0131na u\u011frad\u0131: {e}\")\n    print(\"\u00c7al\u0131\u015fan i\u015flem sonland\u0131r\u0131ld\u0131.\")\n    # Zaman a\u015f\u0131m\u0131na u\u011frayan i\u015flemin \u00e7\u0131kt\u0131s\u0131n\u0131 ve hatas\u0131n\u0131 almak i\u00e7in e.stdout ve e.stderr kullan\u0131labilir\n    # Not: e.stdout\/stderr, i\u015flem sonland\u0131r\u0131lmadan \u00f6nce yakalanan \u00e7\u0131kt\u0131y\u0131 i\u00e7erir\n    if e.stdout:\n        print(\"Yakalanan stdout:\\n\", e.stdout)\n    if e.stderr:\n        print(\"Yakalanan stderr:\\n\", e.stderr)\nexcept FileNotFoundError:\n    print(\"Sleep komutu bulunamad\u0131. (Windows'ta 'timeout' veya 'ping' kullanman\u0131z gerekebilir.)\")<\/code><\/pre>\n<p><code>TimeoutExpired<\/code> istisnas\u0131, zaman a\u015f\u0131m\u0131na u\u011frayan komutun yakalanan <code>stdout<\/code> ve <code>stderr<\/code> \u00e7\u0131kt\u0131lar\u0131n\u0131 da i\u00e7erir, bu da hata ay\u0131klama i\u00e7in faydal\u0131d\u0131r.<\/p>\n<h3>Eski Fonksiyonlar ve Geli\u015fmi\u015f Kullan\u0131mlar<\/h3>\n<p><code>subprocess.run()<\/code> \u00e7o\u011fu durumu kapsasa da, <code>Popen<\/code> s\u0131n\u0131f\u0131 gibi daha d\u00fc\u015f\u00fck seviyeli aray\u00fczler, belirli geli\u015fmi\u015f senaryolar i\u00e7in hala de\u011ferlidir.<\/p>\n<h4><code>subprocess.call()<\/code>, <code>subprocess.check_call()<\/code>, <code>subprocess.check_output()<\/code><\/h4>\n<p>Bu fonksiyonlar, <code>subprocess.run()<\/code>&#8216;dan daha eski ve daha az esnektir:<br \/>\n*   <strong><code>subprocess.call(args, ...)<\/code>:<\/strong> Komutu \u00e7al\u0131\u015ft\u0131r\u0131r ve d\u00f6n\u00fc\u015f kodunu d\u00f6nd\u00fcr\u00fcr. \u00c7\u0131kt\u0131y\u0131 yakalamaz. Genellikle <code>subprocess.run(args).returncode<\/code> ile ayn\u0131d\u0131r.<br \/>\n*   <strong><code>subprocess.check_call(args, ...)<\/code>:<\/strong> Komutu \u00e7al\u0131\u015ft\u0131r\u0131r. D\u00f6n\u00fc\u015f kodu s\u0131f\u0131r de\u011filse <code>CalledProcessError<\/code> f\u0131rlat\u0131r. \u00c7\u0131kt\u0131y\u0131 yakalamaz. Genellikle <code>subprocess.run(args, check=True)<\/code> ile ayn\u0131d\u0131r.<br \/>\n*   <strong><code>subprocess.check_output(args, ...)<\/code>:<\/strong> Komutu \u00e7al\u0131\u015ft\u0131r\u0131r, \u00e7\u0131kt\u0131s\u0131n\u0131 yakalar ve d\u00f6nd\u00fcr\u00fcr. D\u00f6n\u00fc\u015f kodu s\u0131f\u0131r de\u011filse <code>CalledProcessError<\/code> f\u0131rlat\u0131r. Genellikle <code>subprocess.run(args, capture_output=True, check=True).stdout<\/code> ile ayn\u0131d\u0131r.<\/p>\n<p>Bu fonksiyonlar, <code>subprocess.run()<\/code>&#8216;\u0131n daha yeni ve kapsaml\u0131 oldu\u011fu i\u00e7in genellikle \u00f6nerilmez, ancak eski kodlarda veya basit durumlarda hala kar\u015f\u0131la\u015f\u0131labilirler.<\/p>\n<h4><code>subprocess.Popen<\/code>: Daha D\u00fc\u015f\u00fck Seviyeli Kontrol<\/h4>\n<p><code>subprocess.Popen<\/code> s\u0131n\u0131f\u0131, <code>subprocess<\/code> mod\u00fcl\u00fcn\u00fcn temelini olu\u015fturur ve en d\u00fc\u015f\u00fck seviyeli kontrol\u00fc sa\u011flar. Bir alt s\u00fcreci ba\u015flat\u0131r ve Python program\u0131n\u0131z\u0131n ak\u0131\u015f\u0131n\u0131 engellemeden onunla etkile\u015fim kurman\u0131za olanak tan\u0131r. Bu, \u00f6zellikle asenkron i\u015flemler veya ak\u0131\u015flar \u00fczerinde ince ayar yapman\u0131z gerekti\u011finde kullan\u0131\u015fl\u0131d\u0131r.<\/p>\n<p><code>Popen<\/code> nesnesi, alt s\u00fcre\u00e7le ileti\u015fim kurmak i\u00e7in \u00e7e\u015fitli y\u00f6ntemler sunar:<br \/>\n*   <code>poll()<\/code>: Alt s\u00fcrecin hala \u00e7al\u0131\u015f\u0131p \u00e7al\u0131\u015fmad\u0131\u011f\u0131n\u0131 kontrol eder. D\u00f6n\u00fc\u015f kodu varsa d\u00f6nd\u00fcr\u00fcr, yoksa <code>None<\/code> d\u00f6nd\u00fcr\u00fcr.<br \/>\n*   <code>wait(timeout=None)<\/code>: Alt s\u00fcrecin tamamlanmas\u0131n\u0131 bekler ve d\u00f6n\u00fc\u015f kodunu d\u00f6nd\u00fcr\u00fcr. \u0130ste\u011fe ba\u011fl\u0131 bir zaman a\u015f\u0131m\u0131 parametresi alabilir.<br \/>\n*   <code>communicate(input=None, timeout=None)<\/code>: Alt s\u00fcrece veri g\u00f6nderir (stdin), \u00e7\u0131kt\u0131s\u0131n\u0131 (stdout ve stderr) okur ve alt s\u00fcrecin tamamlanmas\u0131n\u0131 bekler. <code>(stdout_data, stderr_data)<\/code> tuple&#8217;\u0131 d\u00f6nd\u00fcr\u00fcr.<br \/>\n*   <code>send_signal(signal)<\/code>: Alt s\u00fcrece bir sinyal g\u00f6nderir.<br \/>\n*   <code>terminate()<\/code>, <code>kill()<\/code>: Alt s\u00fcreci sonland\u0131rmak i\u00e7in kullan\u0131l\u0131r.<\/p>\n<p><strong>\u00d6rnek: Asenkron \u0130\u015flem ve Pipe ile \u0130leti\u015fim<\/strong><\/p>\n<pre><code class=\"language-python\">import subprocess\nimport time\n\nprint(\"Popen ile asenkron i\u015flem ba\u015flat\u0131l\u0131yor...\")\n<h2>'ping' komutunu ba\u015flat, \u00e7\u0131kt\u0131y\u0131 yakala ama bekleme<\/h2>\nprocess = subprocess.Popen(\n    ['ping', '-c', '4', 'google.com'], # Windows i\u00e7in ['ping', 'google.com', '-n', '4']\n    stdout=subprocess.PIPE, # stdout'u pipe'a y\u00f6nlendir\n    stderr=subprocess.PIPE, # stderr'i pipe'a y\u00f6nlendir\n    text=True # \u00c7\u0131kt\u0131y\u0131 metin olarak oku\n)\n\nprint(\"Ana program \u00e7al\u0131\u015fmaya devam ediyor...\")\n<h2>Ana program ba\u015fka i\u015fler yapabilir<\/h2>\ntime.sleep(1)\nprint(\"Ana program 1 saniye bekledi.\")\n\n<h2>Alt s\u00fcrecin tamamlanmas\u0131n\u0131 bekle ve \u00e7\u0131kt\u0131y\u0131 al<\/h2>\nstdout, stderr = process.communicate(timeout=10) # 10 saniye zaman a\u015f\u0131m\u0131 ile bekle\n\nif process.returncode == 0:\n    print(\"\\nKomut ba\u015far\u0131yla tamamland\u0131.\")\n    print(\"Standart \u00c7\u0131kt\u0131:\\n\", stdout)\nelse:\n    print(f\"\\nKomut hata ile sonu\u00e7land\u0131. D\u00f6n\u00fc\u015f kodu: {process.returncode}\")\n    print(\"Standart \u00c7\u0131kt\u0131:\\n\", stdout)\n    print(\"Standart Hata:\\n\", stderr)\n\n<h2>\u00d6rnek: \u0130ki komutu pipe ile ba\u011flama (Popen kullanarak)<\/h2>\nprint(\"\\n\u0130ki komutu pipe ile ba\u011flama (ls -l | grep python):\")\ntry:\n    # \u0130lk komut: ls -l\n    p1 = subprocess.Popen(['ls', '-l'], stdout=subprocess.PIPE, text=True)\n\n    # \u0130kinci komut: grep python. stdin'i p1'in stdout'una ba\u011fla\n    p2 = subprocess.Popen(['grep', 'python'], stdin=p1.stdout, stdout=subprocess.PIPE, text=True)\n\n    # p1'in stdout'unu kapat ki p2 EOF alabilsin\n    p1.stdout.close()\n\n    # p2'nin \u00e7\u0131kt\u0131s\u0131n\u0131 al\n    output = p2.communicate()[0]\n\n    print(\"Pipe \u00e7\u0131kt\u0131s\u0131:\\n\", output)\n\n    # Her iki s\u00fcrecin de tamamland\u0131\u011f\u0131ndan emin ol\n    p1.wait()\n    p2.wait()\nexcept FileNotFoundError:\n    print(\"Komutlardan biri (ls veya grep) bulunamad\u0131.\")\nexcept Exception as e:\n    print(f\"Pipe i\u015flemi s\u0131ras\u0131nda hata olu\u015ftu: {e}\")<\/code><\/pre>\n<p><code>Popen<\/code> ile \u00e7al\u0131\u015f\u0131rken, \u00f6zellikle <code>stdout=subprocess.PIPE<\/code> veya <code>stderr=subprocess.PIPE<\/code> kulland\u0131\u011f\u0131n\u0131zda, <code>communicate()<\/code> \u00e7a\u011fr\u0131s\u0131 ile \u00e7\u0131kt\u0131lar\u0131 okumay\u0131 ve s\u00fcrecin tamamlanmas\u0131n\u0131 beklemeyi unutmamak \u00f6nemlidir. Aksi takdirde, alt s\u00fcre\u00e7 \u00e7\u0131kt\u0131 tamponu doldu\u011funda tak\u0131l\u0131p kalabilir (deadlock).<\/p>\n<h3>G\u00fcvenlik Hususlar\u0131<\/h3>\n<p><code>subprocess<\/code> mod\u00fcl\u00fcn\u00fc kullan\u0131rken g\u00fcvenlik her zaman \u00f6n planda olmal\u0131d\u0131r.<\/p>\n<h4><code>shell=True<\/code> Kullan\u0131m\u0131n\u0131n Riskleri<\/h4>\n<p><code>shell=True<\/code> kullanmak, komutun do\u011frudan i\u015fletim sisteminin kabu\u011fu taraf\u0131ndan yorumlanmas\u0131na neden olur. Bu, kabuk meta karakterlerinin (\u00f6rn. <code>;<\/code>, <code>&<\/code>, <code>|<\/code>, <code>*<\/code>, <code>?<\/code>) \u00f6zel anlamlar kazanmas\u0131na yol a\u00e7ar. E\u011fer kullan\u0131c\u0131dan al\u0131nan girdilerle komut dizesi olu\u015fturuluyorsa ve bu girdi d\u00fczg\u00fcn bir \u015fekilde sanitize edilmezse, bir sald\u0131rgan k\u00f6t\u00fc ama\u00e7l\u0131 komutlar enjekte edebilir (kabuk enjeksiyonu).<\/p>\n<p>\u00d6rne\u011fin, <code>subprocess.run(f\"rm -rf \/tmp\/{user_input}\", shell=True)<\/code> gibi bir kodda, <code>user_input<\/code> de\u011feri <code>\"; rm -rf \/\"<\/code> olursa, bu t\u00fcm k\u00f6k dizini silmeye yol a\u00e7abilir.<\/p>\n<p><strong>Kural:<\/strong> M\u00fcmk\u00fcn oldu\u011funca <code>shell=False<\/code> kullan\u0131n ve komut arg\u00fcmanlar\u0131n\u0131 liste olarak ge\u00e7irin.<\/p>\n<h4><code>args<\/code> Listesi Olarak Ge\u00e7menin \u00d6nemi<\/h4>\n<p>Komut arg\u00fcmanlar\u0131n\u0131 bir liste olarak ge\u00e7mek (\u00f6rn. <code>['ls', '-l', '\/tmp']<\/code>), <code>subprocess<\/code> mod\u00fcl\u00fcn\u00fcn program\u0131 ve arg\u00fcmanlar\u0131n\u0131 do\u011frudan \u00e7al\u0131\u015ft\u0131rmas\u0131n\u0131 sa\u011flar, bir kabuk yorumlay\u0131c\u0131s\u0131 kullanmadan. Bu, arg\u00fcmanlar\u0131n kabuk taraf\u0131ndan yorumlanmas\u0131n\u0131 engeller ve kabuk enjeksiyonu riskini ortadan kald\u0131r\u0131r. <code>subprocess<\/code> mod\u00fcl\u00fc, listedeki her \u00f6\u011feyi ayr\u0131 bir arg\u00fcman olarak ele al\u0131r ve bu arg\u00fcmanlar\u0131 g\u00fcvenli bir \u015fekilde program\u0131n kendisine iletir.<\/p>\n<h4>Kullan\u0131c\u0131 Girdilerini Temizleme<\/h4>\n<p>E\u011fer harici bir komuta kullan\u0131c\u0131dan al\u0131nan bir girdiyi ge\u00e7meniz gerekiyorsa, bu girdiyi her zaman do\u011frulay\u0131n ve temizleyin. G\u00fcvenli karakterler d\u0131\u015f\u0131nda hi\u00e7bir \u015feye izin vermeyin. <code>shell=True<\/code> kullanmaktan ka\u00e7\u0131nam\u0131yorsan\u0131z, girdiyi asla do\u011frudan komut dizesine eklemeyin; bunun yerine <code>shlex.quote()<\/code> gibi fonksiyonlar\u0131 kullanarak girdiyi g\u00fcvenli bir \u015fekilde t\u0131rnak i\u00e7ine al\u0131n.<\/p>\n<pre><code class=\"language-python\">import subprocess\nimport shlex\n\nuser_input = \"dosyam; rm -rf \/\" # K\u00f6t\u00fc niyetli bir girdi\n\n<h2>K\u00f6t\u00fc \u00f6rnek (shell=True ile do\u011frudan girdi kullan\u0131m\u0131 - ASLA YAPMAYIN)<\/h2>\n<h2>try:<\/h2>\n<h2>subprocess.run(f\"cat {user_input}\", shell=True, check=True)<\/h2>\n<h2>except subprocess.CalledProcessError as e:<\/h2>\n<h2>print(f\"K\u00f6t\u00fc niyetli komut \u00e7al\u0131\u015ft\u0131: {e}\")<\/h2>\n\n<h2>\u0130yi \u00f6rnek (shell=False ile liste olarak ge\u00e7me)<\/h2>\ntry:\n    # 'cat' komutu 'dosyam; rm -rf \/' ad\u0131nda bir dosya arayacakt\u0131r, bu da g\u00fcvenlidir.\n    subprocess.run(['cat', user_input], check=True)\nexcept FileNotFoundError:\n    print(f\"G\u00fcvenli: '{user_input}' ad\u0131nda dosya bulunamad\u0131.\")\nexcept subprocess.CalledProcessError as e:\n    print(f\"G\u00fcvenli: 'cat' komutu '{user_input}' dosyas\u0131n\u0131 bulamad\u0131.\")\n\n\n<h2>shell=True kullanmak ZORUNDAYSANIZ (\u00c7OK NAD\u0130R), girdiyi quote edin<\/h2>\nsafe_user_input = shlex.quote(user_input)\nprint(f\"\\nG\u00fcvenli hale getirilmi\u015f girdi: {safe_user_input}\")\ntry:\n    # Bu durumda, kabuk 'cat \"dosyam; rm -rf \/\"' komutunu \u00e7al\u0131\u015ft\u0131r\u0131r\n    # ve bu, tek bir arg\u00fcman olarak yorumlan\u0131r.\n    subprocess.run(f\"cat {safe_user_input}\", shell=True, check=True)\nexcept FileNotFoundError:\n    print(f\"G\u00fcvenli (shell=True ile): '{user_input}' ad\u0131nda dosya bulunamad\u0131.\")\nexcept subprocess.CalledProcessError as e:\n    print(f\"G\u00fcvenli (shell=True ile): 'cat' komutu '{user_input}' dosyas\u0131n\u0131 bulamad\u0131.\")<\/code><\/pre>\n<h3>Platform Farkl\u0131l\u0131klar\u0131 ve Dikkat Edilmesi Gerekenler<\/h3>\n<p>Harici programlarla \u00e7al\u0131\u015f\u0131rken, i\u015fletim sistemleri aras\u0131ndaki farkl\u0131l\u0131klar \u00f6nemli olabilir.<\/p>\n<p>*   <strong>Komut Adlar\u0131 ve Arg\u00fcmanlar\u0131:<\/strong> <code>ls<\/code> (Linux\/macOS) yerine <code>dir<\/code> (Windows), <code>ping -c 4<\/code> (Linux\/macOS) yerine <code>ping -n 4<\/code> (Windows) gibi komut adlar\u0131 ve arg\u00fcmanlar\u0131 farkl\u0131l\u0131k g\u00f6sterebilir. Kodunuzun ta\u015f\u0131nabilir olmas\u0131n\u0131 istiyorsan\u0131z, <code>sys.platform<\/code> kontrol\u00fc ile i\u015fletim sistemine \u00f6zel komutlar yazman\u0131z gerekebilir.<br \/>\n*   <strong>Dosya Yollar\u0131:<\/strong> Dosya yollar\u0131 Unix benzeri sistemlerde <code>\/<\/code> ile, Windows&#8217;ta <code>\\<\/code> ile ayr\u0131l\u0131r. Python&#8217;\u0131n <code>os.path<\/code> mod\u00fcl\u00fc, bu farkl\u0131l\u0131klar\u0131 soyutlamak i\u00e7in faydal\u0131d\u0131r.<br \/>\n*   <strong>Encoding Sorunlar\u0131:<\/strong> <code>text=True<\/code> kullan\u0131ld\u0131\u011f\u0131nda, <code>subprocess<\/code> varsay\u0131lan olarak sistemin tercih edilen kodlamas\u0131n\u0131 (genellikle UTF-8) kullan\u0131r. Ancak baz\u0131 durumlarda, \u00f6zellikle Windows&#8217;ta, harici program\u0131n \u00e7\u0131kt\u0131s\u0131 farkl\u0131 bir kodlamada (\u00f6rn. cp1252) olabilir. Bu durumda, <code>encoding='cp1252'<\/code> gibi belirli bir kodlama belirtmeniz gerekebilir.<\/p>\n<h3>S\u0131k\u00e7a Kar\u015f\u0131la\u015f\u0131lan Sorunlar ve \u00c7\u00f6z\u00fcmleri<\/h3>\n<p><code>subprocess<\/code> mod\u00fcl\u00fc ile \u00e7al\u0131\u015f\u0131rken baz\u0131 yayg\u0131n sorunlarla kar\u015f\u0131la\u015fabilirsiniz:<\/p>\n<p>*   <strong><code>FileNotFoundError<\/code>:<\/strong> Bu, \u00e7al\u0131\u015ft\u0131rmaya \u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131z komutun sistem PATH&#8217;inde bulunamad\u0131\u011f\u0131 veya belirtilen yolda olmad\u0131\u011f\u0131 anlam\u0131na gelir.<br \/>\n    *   <strong>\u00c7\u00f6z\u00fcm:<\/strong> Komutun do\u011fru yaz\u0131ld\u0131\u011f\u0131ndan emin olun. Komutun sistem PATH&#8217;inde oldu\u011fundan emin olun veya tam yolunu belirtin (\u00f6rn. <code>['\/usr\/bin\/ls', '-l']<\/code>). Windows&#8217;ta, baz\u0131 komutlar (\u00f6rn. <code>dir<\/code>) asl\u0131nda kabu\u011fun yerle\u015fik komutlar\u0131d\u0131r ve <code>shell=True<\/code> gerektirebilir.<br \/>\n*   <strong><code>CalledProcessError<\/code>:<\/strong> <code>check=True<\/code> ayarlanm\u0131\u015fken, \u00e7al\u0131\u015ft\u0131r\u0131lan komut s\u0131f\u0131rdan farkl\u0131 bir d\u00f6n\u00fc\u015f koduyla sonland\u0131\u011f\u0131nda f\u0131rlat\u0131l\u0131r.<br \/>\n    *   <strong>\u00c7\u00f6z\u00fcm:<\/strong> <code>e.returncode<\/code>, <code>e.stdout<\/code>, <code>e.stderr<\/code> niteliklerini inceleyerek komutun neden ba\u015far\u0131s\u0131z oldu\u011funu anlamaya \u00e7al\u0131\u015f\u0131n.<br \/>\n*   <strong>Encoding Hatalar\u0131 (<code>UnicodeDecodeError<\/code>):<\/strong> <code>text=True<\/code> ile \u00e7\u0131kt\u0131y\u0131 okurken, harici program\u0131n \u00e7\u0131kt\u0131s\u0131 Python&#8217;\u0131n varsayd\u0131\u011f\u0131 kodlamadan farkl\u0131 oldu\u011funda ortaya \u00e7\u0131kar.<br \/>\n    *   <strong>\u00c7\u00f6z\u00fcm:<\/strong> <code>encoding<\/code> parametresiyle do\u011fru kodlamay\u0131 belirtin (\u00f6rn. <code>encoding='latin-1'<\/code> veya <code>encoding='cp1252'<\/code>). Ayr\u0131ca, <code>errors='ignore'<\/code> veya <code>errors='replace'<\/code> gibi bir hata i\u015fleme stratejisi de belirleyebilirsiniz, ancak bu veri kayb\u0131na yol a\u00e7abilir.<br \/>\n*   <strong>Donanm\u0131\u015f \u0130\u015flemler (Deadlock):<\/strong> <code>Popen<\/code> ile \u00e7al\u0131\u015f\u0131rken ve <code>stdout=PIPE<\/code> veya <code>stderr=PIPE<\/code> kulland\u0131\u011f\u0131n\u0131zda, e\u011fer alt s\u00fcre\u00e7 \u00e7ok fazla veri \u00fcretir ve Python program\u0131n\u0131z bu veriyi yeterince h\u0131zl\u0131 okumazsa, alt s\u00fcrecin \u00e7\u0131kt\u0131 tamponu dolabilir ve alt s\u00fcre\u00e7 kilitlenebilir. Bu durum, Python program\u0131n\u0131z\u0131n da <code>communicate()<\/code> veya <code>wait()<\/code> \u00e7a\u011fr\u0131s\u0131nda sonsuza kadar beklemesine neden olabilir.<br \/>\n    *   <strong>\u00c7\u00f6z\u00fcm:<\/strong> <code>communicate()<\/code> y\u00f6ntemini kullanarak \u00e7\u0131kt\u0131lar\u0131 okuyun ve s\u00fcreci bekleyin. E\u011fer \u00e7\u0131kt\u0131 \u00e7ok b\u00fcy\u00fckse ve par\u00e7alar halinde okunmas\u0131 gerekiyorsa, ayr\u0131 bir i\u015f par\u00e7ac\u0131\u011f\u0131nda (thread) veya asenkron olarak okuma yapmay\u0131 d\u00fc\u015f\u00fcnebilirsiniz.<\/p>\n<h3>Sonu\u00e7<\/h3>\n<p><code>subprocess<\/code> mod\u00fcl\u00fc, Python 3&#8217;te harici programlar\u0131 \u00e7al\u0131\u015ft\u0131rmak i\u00e7in g\u00fc\u00e7l\u00fc, g\u00fcvenli ve esnek bir ara\u00e7t\u0131r. \u00c7o\u011fu senaryo i\u00e7in <code>subprocess.run()<\/code> fonksiyonu tercih edilen yakla\u015f\u0131md\u0131r, zira y\u00fcksek seviyeli bir aray\u00fcz sunarken ayn\u0131 zamanda hata y\u00f6netimi, \u00e7\u0131kt\u0131 yakalama ve zaman a\u015f\u0131m\u0131 gibi \u00f6nemli \u00f6zellikleri de b\u00fcnyesinde bar\u0131nd\u0131r\u0131r. Daha karma\u015f\u0131k senaryolar, \u00f6zellikle asenkron i\u015flemler veya ak\u0131\u015flar \u00fczerinde detayl\u0131 kontrol gerektiren durumlar i\u00e7in <code>subprocess.Popen<\/code> s\u0131n\u0131f\u0131 daha uygun olabilir.<\/p>\n<p>G\u00fcvenlik, <code>subprocess<\/code> mod\u00fcl\u00fcn\u00fc kullan\u0131rken asla g\u00f6z ard\u0131 edilmemesi gereken bir konudur. Komut arg\u00fcmanlar\u0131n\u0131 liste olarak ge\u00e7mek ve <code>shell=True<\/code> kullan\u0131m\u0131ndan ka\u00e7\u0131nmak, kabuk enjeksiyonu gibi yayg\u0131n g\u00fcvenlik a\u00e7\u0131klar\u0131n\u0131 \u00f6nlemenin en etkili yollar\u0131d\u0131r. Platform farkl\u0131l\u0131klar\u0131n\u0131 g\u00f6z \u00f6n\u00fcnde bulundurarak ve potansiyel hatalar\u0131 do\u011fru \u015fekilde y\u00f6neterek, Python uygulamalar\u0131n\u0131z\u0131 harici programlarla sorunsuz bir \u015fekilde entegre edebilirsiniz. Bu mod\u00fcl\u00fc ustaca kullanarak, Python&#8217;\u0131n g\u00fcc\u00fcn\u00fc i\u015fletim sisteminizin yetenekleriyle birle\u015ftirebilir ve \u00e7ok daha yetenekli ve kapsaml\u0131 uygulamalar geli\u015ftirebilirsiniz.<\/body><\/p>\n","protected":false},"excerpt":{"rendered":"Python 3&#8217;te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_page_header_type":"","csco_page_load_nextpost":"","csco_page_subscribe_form":"","csco_page_contact_form":"","footnotes":""},"categories":[1403],"tags":[],"class_list":{"0":"post-41275","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-python","7":"cs-entry","8":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.5 (Yoast SEO v25.3.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python 3&#039;te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r? - Kodlar\u0131n Gizemli D\u00fcnyas\u0131<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python 3&#039;te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?\" \/>\n<meta property=\"og:description\" content=\"Python 3&#039;te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-21T14:00:51+00:00\" \/>\n<meta name=\"author\" content=\"Fatih Soysal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatih Soysal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"21 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"Python 3&#8217;te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?\",\"datePublished\":\"2026-03-21T14:00:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/\"},\"wordCount\":2532,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"articleSection\":[\"Python\"],\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/#respond\"]}],\"copyrightYear\":\"2026\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/\",\"name\":\"Python 3'te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r? - Kodlar\u0131n Gizemli D\u00fcnyas\u0131\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2026-03-21T14:00:51+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python 3&#8217;te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/\",\"name\":\"Fatihsoysal.com\",\"description\":\"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim\",\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\",\"name\":\"Fatih Soysal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"contentUrl\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"width\":512,\"height\":512,\"caption\":\"Fatih Soysal\"},\"logo\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python 3'te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r? - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/","og_locale":"tr_TR","og_type":"article","og_title":"Python 3'te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?","og_description":"Python 3'te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?","og_url":"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2026-03-21T14:00:51+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"21 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"Python 3&#8217;te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?","datePublished":"2026-03-21T14:00:51+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/"},"wordCount":2532,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"articleSection":["Python"],"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/#respond"]}],"copyrightYear":"2026","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/","url":"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/","name":"Python 3'te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r? - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2026-03-21T14:00:51+00:00","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/python-3te-harici-programlari-calistirmak-icin-subprocess-modulu-nasil-kullanilir\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python 3&#8217;te Harici Programlar\u0131 \u00c7al\u0131\u015ft\u0131rmak \u0130\u00e7in subprocess Mod\u00fcl\u00fc Nas\u0131l Kullan\u0131l\u0131r?"}]},{"@type":"WebSite","@id":"https:\/\/fatihsoysal.com\/blog\/#website","url":"https:\/\/fatihsoysal.com\/blog\/","name":"Fatihsoysal.com","description":"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim","publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1","name":"Fatih Soysal","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","contentUrl":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","width":512,"height":512,"caption":"Fatih Soysal"},"logo":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/"},"description":"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.","url":"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/"}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/41275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/comments?post=41275"}],"version-history":[{"count":1,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/41275\/revisions"}],"predecessor-version":[{"id":41276,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/41275\/revisions\/41276"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=41275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=41275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=41275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}