change default port

This commit is contained in:
Omar Sánchez Pizarro
2019-05-08 01:21:00 +02:00
parent 1bec326550
commit 367b0fb254

View File

@@ -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,9 +79,9 @@ 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: