PK!9NN speiseplan.pyimport urllib.parse import subprocess import platform import json try: from requests_html import HTMLSession except ImportError: from pip._internal import main main(["install", "-q", "requests_html"]) from requests_html import HTMLSession session = HTMLSession() def get_pct(url="https://www.die-karlotte.de/Cafeteria-PCT-Potsdam"): r = session.get(url) links = r.html.absolute_links pdf_link = next(x for x in links if ".pdf" in x) pdf_link = list(urllib.parse.urlparse(pdf_link)) pdf_link[-1] = "" pdf_link[-2] = "" return urllib.parse.urlunparse(pdf_link) def get_studentenwerk( url="https://www.studentenwerk-potsdam.de/essen/unsere-mensen-cafeterien", mensa_id=7, ): def is_my_mensa(link): query = urllib.parse.parse_qs(link.query) try: this_id = int(query["tx_ddfmensa_ddfmensa[mensa]"][0]) return this_id == mensa_id except KeyError: return False r = session.get(url) links = map(urllib.parse.urlparse, r.html.absolute_links) mymensa = next(filter(is_my_mensa, links)) return mymensa.geturl() def main(): open_cmd = "open" if platform.system() == "Darwin" else "xdg-open" for menu in [get_pct(), get_studentenwerk()]: subprocess.run([open_cmd, menu]) if __name__ == "__main__": main() PK!HV0 Z'.+speiseplan-0.1.1.dist-info/entry_points.txtN+I/N.,()*.H,N-I̳E0r3PK!--"speiseplan-0.1.1.dist-info/LICENSEMIT License Copyright (c) 2019 Markus Quade Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HڽTU speiseplan-0.1.1.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!H&>y#speiseplan-0.1.1.dist-info/METADATAMOA + 3 $‚ǹqҸ3̇ ޮ"ƣ}m5$P/"ygPF)bׂgZ6[ hU ۟jZ%,Ob!(2xZHr;m!fLȩH+]b!/=%Icz gd|Zr\k2j_|K1EG٪:>V^̦...'PK!HuB(!speiseplan-0.1.1.dist-info/RECORD}vC@}eFBsHd!xvK?iqNp[F">6F/?Ɯ|9>;%ìA=/awGN(ikkJvt3)U<8BeLNRdv'B_ lLCE'9:wXRgn[MY+^:z*-%7Xl& +{VU-Cw [y# speiseplan-0.1.1.dist-info/METADATAPK!HuB(! speiseplan-0.1.1.dist-info/RECORDPK