Created
January 29, 2016 22:43
-
-
Save volkanozcan/74ba2752c28f83746035 to your computer and use it in GitHub Desktop.
loto_requests.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"metadata": { | |
"trusted": true, | |
"hide_input": false, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "url=\"http://www.millipiyango.gov.tr/sonuclar/cekilisler/sayisal/19961116.json\"", | |
"execution_count": 20, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"hide_input": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "import datetime,requests,json,numpy as np\nimport threading", | |
"execution_count": 21, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"hide_input": false, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "ilk=datetime.date(1996,11,16)", | |
"execution_count": 22, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"hide_input": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "loto=[]", | |
"execution_count": 23, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "def sonuc(x):\n if(type(x)==datetime.date):\n url=\"http://www.millipiyango.gov.tr/sonuclar/cekilisler/sayisal/%s.json\"%x.strftime(\"%Y%m%d\")\n response=requests.get(url,timeout=None)\n data=json.loads(response.text)\n return data[\"data\"][\"rakamlarNumaraSirasi\"]\n else:\n print(\"tip uyuşmadı datetime.date nesnesi oluştur\")\n ", | |
"execution_count": 39, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "%%timeit \nsonuc(ilk+ datetime.timedelta(days=14))", | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "%%timeit -n1 -r1\nadder=7\nfor i in range(100):\n print(\"{}.hafta sonucu : {}\".format(int(adder/7),sonuc(ilk+ datetime.timedelta(days=adder))))\n adder+=7", | |
"execution_count": 42, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": "1.hafta sonucu : 3 - 14 - 16 - 23 - 27 - 43\n2.hafta sonucu : 6 - 22 - 26 - 31 - 38 - 44\n3.hafta sonucu : 7 - 11 - 16 - 18 - 25 - 26\n4.hafta sonucu : 2 - 5 - 14 - 30 - 31 - 39\n5.hafta sonucu : 2 - 14 - 24 - 25 - 30 - 36\n6.hafta sonucu : 4 - 8 - 14 - 24 - 27 - 36\n7.hafta sonucu : 3 - 17 - 36 - 41 - 46 - 47\n8.hafta sonucu : 4 - 15 - 16 - 18 - 27 - 41\n9.hafta sonucu : 5 - 11 - 24 - 29 - 41 - 45\n10.hafta sonucu : 22 - 26 - 37 - 38 - 39 - 49\n11.hafta sonucu : 13 - 22 - 33 - 38 - 39 - 40\n12.hafta sonucu : 11 - 18 - 30 - 40 - 41 - 43\n13.hafta sonucu : 3 - 4 - 19 - 26 - 27 - 37\n14.hafta sonucu : 14 - 28 - 32 - 38 - 41 - 45\n15.hafta sonucu : 18 - 28 - 29 - 32 - 43 - 44\n16.hafta sonucu : 2 - 16 - 20 - 22 - 25 - 27\n17.hafta sonucu : 11 - 15 - 21 - 33 - 37 - 38\n18.hafta sonucu : 2 - 12 - 13 - 25 - 30 - 39\n19.hafta sonucu : 19 - 32 - 33 - 41 - 46 - 49\n20.hafta sonucu : 1 - 2 - 18 - 19 - 23 - 45\n21.hafta sonucu : 14 - 17 - 28 - 33 - 35 - 49\n22.hafta sonucu : 1 - 2 - 4 - 12 - 35 - 48\n23.hafta sonucu : 3 - 5 - 10 - 22 - 23 - 31\n24.hafta sonucu : 5 - 11 - 17 - 36 - 38 - 41\n25.hafta sonucu : 1 - 8 - 16 - 28 - 39 - 40\n26.hafta sonucu : 15 - 20 - 23 - 30 - 39 - 47\n27.hafta sonucu : 1 - 6 - 10 - 35 - 43 - 49\n28.hafta sonucu : 8 - 13 - 21 - 28 - 34 - 38\n29.hafta sonucu : 14 - 21 - 27 - 35 - 42 - 46\n30.hafta sonucu : 11 - 18 - 36 - 38 - 44 - 48\n31.hafta sonucu : 15 - 16 - 21 - 28 - 38 - 49\n32.hafta sonucu : 8 - 13 - 23 - 25 - 38 - 40\n33.hafta sonucu : 6 - 9 - 10 - 13 - 38 - 41\n34.hafta sonucu : 2 - 9 - 11 - 13 - 27 - 49\n35.hafta sonucu : 7 - 21 - 22 - 30 - 33 - 39\n36.hafta sonucu : 5 - 11 - 13 - 24 - 38 - 47\n37.hafta sonucu : 10 - 15 - 17 - 28 - 32 - 37\n38.hafta sonucu : 8 - 16 - 20 - 28 - 36 - 45\n39.hafta sonucu : 12 - 27 - 34 - 39 - 47 - 49\n40.hafta sonucu : 8 - 16 - 26 - 28 - 34 - 47\n41.hafta sonucu : 5 - 20 - 27 - 29 - 32 - 46\n42.hafta sonucu : 7 - 13 - 14 - 16 - 17 - 21\n43.hafta sonucu : 4 - 7 - 10 - 21 - 37 - 49\n44.hafta sonucu : 7 - 27 - 30 - 33 - 38 - 46\n45.hafta sonucu : 22 - 25 - 26 - 32 - 34 - 45\n46.hafta sonucu : 14 - 20 - 28 - 38 - 41 - 48\n47.hafta sonucu : 3 - 15 - 32 - 36 - 38 - 45\n48.hafta sonucu : 17 - 21 - 22 - 24 - 30 - 47\n49.hafta sonucu : 15 - 21 - 35 - 37 - 43 - 49\n50.hafta sonucu : 1 - 13 - 16 - 19 - 33 - 35\n51.hafta sonucu : 1 - 10 - 35 - 37 - 40 - 47\n52.hafta sonucu : 1 - 17 - 31 - 32 - 41 - 43\n53.hafta sonucu : 5 - 13 - 15 - 27 - 31 - 32\n54.hafta sonucu : 12 - 19 - 35 - 41 - 46 - 47\n55.hafta sonucu : 10 - 12 - 21 - 37 - 43 - 49\n56.hafta sonucu : 8 - 14 - 21 - 37 - 39 - 41\n57.hafta sonucu : 1 - 21 - 24 - 29 - 30 - 32\n58.hafta sonucu : 1 - 21 - 26 - 32 - 33 - 48\n59.hafta sonucu : 13 - 20 - 25 - 28 - 31 - 35\n60.hafta sonucu : 11 - 14 - 20 - 27 - 37 - 38\n61.hafta sonucu : 5 - 9 - 12 - 16 - 26 - 37\n62.hafta sonucu : 7 - 14 - 19 - 34 - 41 - 42\n63.hafta sonucu : 3 - 8 - 11 - 30 - 40 - 44\n64.hafta sonucu : 2 - 7 - 27 - 41 - 42 - 45\n65.hafta sonucu : 19 - 23 - 28 - 30 - 39 - 45\n66.hafta sonucu : 10 - 18 - 27 - 35 - 38 - 49\n67.hafta sonucu : 11 - 16 - 27 - 35 - 38 - 49\n68.hafta sonucu : 3 - 8 - 15 - 35 - 40 - 49\n69.hafta sonucu : 12 - 16 - 23 - 36 - 43 - 49\n70.hafta sonucu : 2 - 7 - 16 - 24 - 25 - 36\n71.hafta sonucu : 6 - 8 - 9 - 20 - 25 - 34\n72.hafta sonucu : 1 - 4 - 15 - 33 - 39 - 42\n73.hafta sonucu : 2 - 8 - 14 - 17 - 20 - 38\n74.hafta sonucu : 1 - 20 - 22 - 35 - 39 - 47\n75.hafta sonucu : 4 - 13 - 20 - 34 - 44 - 48\n76.hafta sonucu : 6 - 10 - 18 - 28 - 29 - 30\n77.hafta sonucu : 5 - 9 - 20 - 28 - 35 - 40\n78.hafta sonucu : 13 - 16 - 28 - 29 - 39 - 46\n79.hafta sonucu : 8 - 15 - 17 - 35 - 36 - 44\n80.hafta sonucu : 9 - 11 - 12 - 13 - 37 - 47\n81.hafta sonucu : 2 - 7 - 16 - 17 - 27 - 29\n82.hafta sonucu : 1 - 4 - 17 - 20 - 23 - 43\n83.hafta sonucu : 6 - 16 - 26 - 44 - 46 - 48\n84.hafta sonucu : 11 - 15 - 33 - 40 - 45 - 48\n85.hafta sonucu : 9 - 14 - 16 - 22 - 27 - 48\n86.hafta sonucu : 20 - 22 - 24 - 29 - 34 - 41\n87.hafta sonucu : 2 - 3 - 13 - 19 - 22 - 37\n88.hafta sonucu : 5 - 24 - 41 - 43 - 45 - 47\n89.hafta sonucu : 2 - 10 - 35 - 36 - 38 - 41\n90.hafta sonucu : 3 - 4 - 5 - 10 - 16 - 20\n91.hafta sonucu : 6 - 21 - 29 - 38 - 40 - 47\n92.hafta sonucu : 5 - 17 - 18 - 39 - 42 - 46\n93.hafta sonucu : 20 - 23 - 37 - 39 - 41 - 42\n94.hafta sonucu : 7 - 29 - 36 - 38 - 41 - 42\n95.hafta sonucu : 23 - 27 - 28 - 30 - 35 - 39\n96.hafta sonucu : 19 - 23 - 25 - 40 - 41 - 44\n97.hafta sonucu : 3 - 12 - 22 - 23 - 25 - 29\n98.hafta sonucu : 8 - 13 - 20 - 32 - 37 - 42\n99.hafta sonucu : 5 - 10 - 14 - 15 - 25 - 40\n100.hafta sonucu : 9 - 12 - 19 - 22 - 24 - 32\n1 loops, best of 1: 7.75 s per loop\n", | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "", | |
"execution_count": null, | |
"outputs": [] | |
} | |
], | |
"metadata": { | |
"latex_envs": { | |
"eqLabelWithNumbers": true, | |
"bibliofile": "biblio.bib", | |
"current_citInitial": 1, | |
"cite_by": "apalike", | |
"eqNumInitial": 0 | |
}, | |
"hide_input": false, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3", | |
"language": "python" | |
}, | |
"language_info": { | |
"mimetype": "text/x-python", | |
"pygments_lexer": "ipython3", | |
"file_extension": ".py", | |
"version": "3.5.1", | |
"name": "python", | |
"codemirror_mode": { | |
"version": 3, | |
"name": "ipython" | |
}, | |
"nbconvert_exporter": "python" | |
}, | |
"gist": { | |
"id": "", | |
"data": { | |
"description": "loto_requests.ipynb", | |
"public": true | |
} | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment