diff --git a/autoficher.py b/autoficher.py index ceaa247..aca0f36 100755 --- a/autoficher.py +++ b/autoficher.py @@ -20,8 +20,7 @@ import os import json import sys -from datetime import datetime -from datetime import timedelta +from datetime import datetime, timedelta import requests import urllib.parse import argparse @@ -41,17 +40,6 @@ optionalArgs.add_argument('-h', '--help', action="help", help="Esta ayuda") args = parser.parse_args() -# Comprobamos que todos los argumentos estan introducidos -if not args.user: - print("Usuario no introducido") - sys.exit(1) -if not args.pin: - print("Pin no introducido") - sys.exit(1) -if not args.type: - print("Tipo de marcaje no introducido") - sys.exit(1) - class AutoFicher(): # URL de la api url = "https://timenet.gpisoftware.com/api/v1/cp/" @@ -91,13 +79,13 @@ class AutoFicher(): headers = {"Content-type": "application/x-www-form-urlencoded", "token": self.token} data = {"typ": args.type, "date": urllib.parse.quote(self.date), "geoLatitude": "41.3908992", "geoLongitude": "2.154496", "geoErrors": ""} - response = requests.post(self.url+"checks", data=json.dumps(data), headers=headers) + response = requests.post(self.url+"checks", data=data, headers=headers) if response.status_code != 200: - print("Error "+str(response.status_code)+" al realizar el envio: "+ response.text) + print("Error "+str(response.status_code)+" al realizar el envio: "+ response.request.body) else: print(response.text) else: print("Hoy no se trabaja") if __name__ == '__main__': - AutoFicher().sendUpdate() \ No newline at end of file + AutoFicher().sendUpdate()