Skip to content

Commit 08322d7

Browse files
author
mustafa
committed
birkac sey
1 parent 7e256fa commit 08322d7

File tree

12 files changed

+298
-1
lines changed

12 files changed

+298
-1
lines changed

Kalender.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"""
1010
month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,31]
1111

12-
month = 8
12+
month = 3
1313

1414
inital_array = []
1515
for day in range(0,month_days[month]):

col.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from collections import Counter
2+
3+
data = ["ahmet","mehmet","ahmet","cihan","ihsan","ziya","ziya","ziya"]
4+
data2 = ["ahmet","mehmet","ahmet","cihan","ihsan","ziya","ziya","ziya","derya"]
5+
6+
data = Counter(data)
7+
data2 = Counter(data2)
8+
data.subtract(data2)
9+
print(dict(data))
10+
11+
print(list(data))
12+
print(data.most_common(2))
13+
z = Counter(a=1,b=2,ihsan=9)
14+
print(list(z.elements()))
15+
data3 = Counter("mustafa")
16+
print(data3.most_common(2))
17+
print(list(z))
18+
c = Counter(a=4, b=2, c=0, d=-2)
19+
d = Counter(a=1, b=2, c=3, d=4)
20+
c.subtract(d)
21+
print(dict(c))

dosyaklasor.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import os
2+
3+
satir = os.path.abspath("../hebebebebbebse")
4+
print(satir)
5+
6+
if os.path.exists(satir) is False:
7+
8+
9+
os.mkdir(satir)
10+
11+
print(os.path.exists(satir))
12+
satir2 = os.path.abspath("./seda")
13+
satir3 = os.path.abspath(".")
14+
print(satir2)
15+
print(satir3)
16+
17+
dosya = os.path.join(satir2,"sedan")
18+
print(os.path.dirname(dosya))
19+
print(dosya)
20+
if os.path.exists(dosya):
21+
os.remove(dosya)
22+
for i in os.listdir(satir3):
23+
print(i)
24+
25+
26+
for i in os.listdir(satir):
27+
yeni_path = os.path.join(satir,i)
28+
print(os.path.isdir(yeni_path))
29+
print(os.path.isfile(yeni_path))
30+
print(i)

flsk_login.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from flask import Flask, render_template, session, request, redirect
2+
3+
app = Flask(__name__)
4+
app.secret_key = 'asd0212£$½#$¾#$½'
5+
6+
@app.route("/logout")
7+
def logout():
8+
session.pop('loggedin')
9+
return redirect("/")
10+
11+
@app.route("/",methods=['GET','POST'])
12+
def home():
13+
print(request.method)
14+
print(request.form)
15+
print(request.headers)
16+
17+
if request.headers.get('User-Agent').lower().find('mozilla') == -1:
18+
return "İZİNSİZ"
19+
if request.method == 'POST':
20+
print(dict(request.form))
21+
if request.form.get('email') == '[email protected]' and request.form.get('password') == 'mustafa':
22+
session['loggedin'] = 'asdasdasd'
23+
24+
if session.get('loggedin', None) is None:
25+
return render_template("index.html")
26+
else:
27+
return render_template("hello.html")
28+
29+
30+
if __name__ == '__main__':
31+
app.run(debug=True,host="0.0.0.0")

imdb.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import json
2+
3+
import requests
4+
5+
6+
class Movie():
7+
title = None
8+
id = None
9+
10+
def __init__(self, title, id):
11+
self.session = requests.session()
12+
self.title = title
13+
self.id = id
14+
15+
def get_info(self):
16+
try:
17+
data = self.session.get('https://www.imdb.com/title/{id}/?ref_=nv_sr_1'.format(id=self.id)).content.decode(
18+
'utf-8')
19+
return data.split('<span itemprop="ratingValue">')[1].split('<')[0]
20+
except:
21+
return "N/A"
22+
23+
def __str__(self):
24+
return "{} ({})".format(self.title, self.id)
25+
26+
def __unicode__(self):
27+
return "{} ({})".format(self.title, self.id)
28+
29+
30+
class Parser():
31+
session = None
32+
search_results = []
33+
34+
def __init__(self):
35+
self.session = requests.session()
36+
37+
def search(self, keyword):
38+
data = self.session.get(
39+
'https://v2.sg.media-imdb.com/suggests/{aramailk}/{arama}.json'.format(
40+
aramailk=keyword[0],
41+
arama=keyword))
42+
content = data.content.decode("utf-8")
43+
suggests_json = content.split('imdb${sup}('.format(sup=keyword))[1][:-1]
44+
suggests = json.loads(suggests_json)
45+
46+
for suggest in suggests.get('d'):
47+
self.search_results.append(Movie(**{
48+
"title": suggest.get('l'),
49+
"id": suggest.get('id')
50+
}))
51+
return self
52+
53+
def get_results(self):
54+
return self.search_results
55+
56+
57+
parse = Parser()
58+
for movie in parse.search("supernat").get_results():
59+
print(movie, movie.get_info())

imdb_parser.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import json
2+
import requests
3+
kullanici_girdisi = input("Aramak istediginizi giriniz :")
4+
data = requests.get('https://v2.sg.media-imdb.com/suggests/{aramailk}/{arama}.json'.format(aramailk=kullanici_girdisi[0],arama=kullanici_girdisi))
5+
content = data.content.decode("utf-8")
6+
suggests_json = content.split('imdb${sup}('.format(sup=kullanici_girdisi))[1][:-1]
7+
suggests = json.loads(suggests_json)
8+
number = 0
9+
for i in suggests.get("d"):
10+
number +=1
11+
print(number,i.get('l'))
12+
secim = input("Lütfen Seçim Yapım :")
13+
if secim.isnumeric():
14+
secim = int(secim)
15+
sectigin_element = suggests.get("d")[secim]
16+
sectigim_sayfa = requests.get('https://www.imdb.com/title/{id}/?ref_=nv_sr_1'.format(id=sectigin_element.get('id')))
17+
18+
#
19+
# for i in suggests:
20+
# print(i)

kalendermesrep.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import calendar
2+
kalender = calendar.Calendar()
3+
kalender.setfirstweekday(1)
4+
print(calendar.weekday(2018,8,4))
5+
print(list(kalender.itermonthdates(2018,8)))
6+
print(list(kalender.iterweekdays()))

login_test.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import time
2+
3+
import requests
4+
5+
6+
def login_miyiz():
7+
xdata = session_request.get("http://192.168.1.108:5000/").content.decode("utf-8")
8+
return xdata
9+
10+
11+
session_request = requests.session()
12+
session_request.headers = {"User-Agent": "Mozilla 5.0", "Naper": "Seda", "Seda": "Zeda"}
13+
14+
while True:
15+
if login_miyiz().find("İYİ Kİ DOĞDUN SEMİHA") > -1:
16+
print('loginiz')
17+
time.sleep(5)
18+
else:
19+
kullanici_adi = input('Kullanıcı Adı Giriniz : ')
20+
parola = input('Parola Giriniz : ')
21+
data = session_request.post("http://192.168.1.108:5000/", data={"email": kullanici_adi,
22+
"password": parola}).content.decode("utf-8")
23+
print(data)

pathlibnasilcalisir.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import os
2+
from pathlib import Path
3+
4+
5+
6+
dosya = Path(".")
7+
sedanin_klasoru = dosya / "seda"
8+
sedanin_klasoru_2 = dosya / "seda" / "eda"
9+
edanin_dosyasi = dosya / "seda" / "eda" / "deneme.txt"
10+
11+
if sedanin_klasoru_2.exists() is False:
12+
sedanin_klasoru_2.mkdir()
13+
sedanin_dosyasi = dosya / "seda" / "seda_2"
14+
15+
with sedanin_dosyasi.open("w") as file:
16+
file.write("Burda Text Var")
17+
18+
if edanin_dosyasi.exists() is False:
19+
with edanin_dosyasi.open("w") as file:
20+
file.write("Merhaba Dünya!")
21+
22+
deneme_path = os.path.join(os.path.abspath("./"),"seda")
23+
for i in os.listdir(deneme_path):
24+
if len( i.split(".")) > 1:
25+
if i.split(".")[1] == "py":
26+
file_name = os.path.join(deneme_path,i)
27+
with open(file_name) as file:
28+
print(file.read())
29+
30+
for i in sedanin_klasoru.glob("*.py"):
31+
with i.open() as file:
32+
print(file.read())
33+
34+
for i in range(10):
35+
yeni_klasor = sedanin_klasoru / "ihsanin_klasoru_{}".format(i)
36+
if yeni_klasor.exists() is False:
37+
yeni_klasor.mkdir()
38+
39+
for i in sedanin_klasoru.glob("*.py"):
40+
i.replace(sedanin_klasoru / "deneme2.py")
41+
42+
if i.is_file():
43+
print("Bu bir dosyadır")

seda/seda_2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Burda Text Var

0 commit comments

Comments
 (0)