{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from controller.Helio_Controller import Helio_Controller" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "controller = Helio_Controller()\n", "controller.set_helio_config()\n", "controller.read_mappings()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "controller.create_task()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "controller.retrieve_file()" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "import hashlib\n", "from urllib.parse import quote" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "url_string = \"https://github.com/oeg-upm/cogito_wrapper_module/blob/main/repository/schedule/files/schedule.xml\"" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "hash_object = hashlib.sha256(url_string.encode('utf-8'))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ab1bcd9e714bcb09d1a23acdb59dbfaa84b11016eae05a20cbbf637d3f49be80\n" ] } ], "source": [ "value = hash_object.hexdigest()\n", "print(value)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "ename": "AttributeError", "evalue": "'str' object has no attribute 'hashlib'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", "\u001b[1;32m/Users/salva/Dropbox/cogito/platform_code/cogito_wrapper_module/try2.ipynb Celda 9\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0m value\u001b[39m.\u001b[39;49mhashlib\u001b[39m.\u001b[39mdecrypt()\n", "\u001b[0;31mAttributeError\u001b[0m: 'str' object has no attribute 'hashlib'" ] } ], "source": [ "def check_user(h):\n", " for i in l:\n", " if h == hashlib.sha256(url_string.encode('utf-8')).hexdigest():\n", " return i" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "from urllib import request" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "remote_url = \"https://raw.githubusercontent.com/oeg-upm/cogito_wrapper_module/main/repository/schedule/files/schedule.xml\"" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "local_file = \"./repository/schedule/example/haha.xml\"" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('./repository/schedule/example/haha.xml',\n", " )" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "request.urlretrieve(remote_url, local_file)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.10.2 64-bit ('3.10.2')", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.2" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "a9c44c8ff930b067c6bc3f134a348d3cb9f19f01dfb46c39e0c18c228169b636" } } }, "nbformat": 4, "nbformat_minor": 2 }