Skip to content
Extraits de code Groupes Projets
Valider 104e52fc rédigé par Loïc Wikle DUBARD's avatar Loïc Wikle DUBARD
Parcourir les fichiers

script useless/quizz.py complet

parent f796dab5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 173 ajouts et 0 suppression
# CHANGELOG:
## 17 aout 2019
- Script useless/quizz.py complet
---
## 16 aout 2019
**Ajout scripts de titch :**
- chuck norris
- haddock
- manger
- nordpresse
- philotron
- pipotron
- kohlanta
- quizz
- rateau
- useless
\ No newline at end of file
#!/usr/bin/python3
import fbchat
from getpass import getpass
username = str(input("Username: "))
client = fbchat.Client(username, getpass())
no_of_friends = int(input("Number of friends: "))
for i in range(no_of_friends):
name = str(input("Name: "))
friends = client.getUsers(name) # return a list of names
friend = friends[0]
msg = str(input("Message: "))
sent = client.send(friend.uid, msg)
if sent:
print("Message sent successfully!")
from flask import Blueprint
routes = Blueprint('routes', __name__)
from .auth import *
from .respond import *
\ No newline at end of file
from flask import Flask, request, jsonify, Response
import json
from . import routes
import requests
from pprint import pprint
VERIFY_TOKEN = 'kameronkales'
@routes.route("/auth", methods=['GET'])
def handle_verification():
if request.args['hub.verify_token'] == VERIFY_TOKEN:
return request.args['hub.challenge']
else:
return "Invalid verification token"
from flask import Flask, request, jsonify, Response
import json
from . import routes
import requests
from pprint import pprint
VERIFY_TOKEN = 'kameronkales'
ACCESS_TOKEN = 'EAAGZCfOZCdjZBwBANkL6JEMJ8BQodNR76c2HLpteN63F3phr4b9sqVjeGsapiCS1ZC5MzGJxXZA4dpLk6OHUZA0KJp1ZAnYaEijZBllkvbpnFCejFyCxj9y8nrCmjASxWTspIZAhBuEnWh3UBTOyJxGSDiZBAIxeKZBHiUeLcTBuZCkrHwZDZD'
def reply(user_id, msg):
data = {
"recipient": {"id": user_id},
"message": {"text": msg}
}
url = "https://graph.facebook.com/v2.6/me/messages?access_token={}".format(ACCESS_TOKEN)
resp = requests.post(url, json=data)
print(resp.content)
@routes.route("/auth", methods=['POST'])
def handle_incoming_messages():
data = request.json
sender = data['entry'][0]['messaging'][0]['sender']['id']
message = data['entry'][0]['messaging'][0]['message']['text']
reply(sender, message)
return "ok"
#!/usr/bin/python3
from flask import Flask, request, jsonify, Response
import json
from routes import *
app = Flask(__name__)
app.register_blueprint(routes)
@app.route('/')
def hello_world():
return 'Hello, World!'
if __name__ == "__main__":
app.run(debug=True, port=5000)
# __init__.py
from .rateau import getRateau
from .chuck import chuck
from .useless import useless
from .nordpresse import nordpresse
from .philotron import genererSujet
from .pipotron import pipo
from .haddock import haddock
from .quizz import quizz
Fichier ajouté
Fichier ajouté
Fichier ajouté
Fichier ajouté
Fichier ajouté
Fichier ajouté
Fichier ajouté
Fichier ajouté
Fichier ajouté
Fichier ajouté
#!/usr/bin/python3
# coding:utf8
import requests
import html
def chuck():
"""raconte la vie de chuck norris"""
try:
r = requests.get("http://www.chucknorrisfacts.fr/api/get?data=tri:alea;nb:1")
rep = r.json()[0]['fact']
return html.unescape(rep)
except:
return 'Houston, on a un problème'
if __name__ == '__main__':
print(chuck())
#!/usr/bin/python3
# coding: utf-8
# https://fr.akinator.com/game
import akinator
aki = akinator.Akinator()
def main():
q = aki.start_game()
while aki.progression <= 85:
a = input(q + "\n\t")
if a == "b":
try:
q = aki.back()
except akinator.CantGoBackAnyFurther:
pass
else:
q = aki.answer(a)
aki.win()
correct = input(f"It's {aki.name} ({aki.description})! Was I correct?\n{aki.picture}\n\t")
if correct.lower() == "yes" or correct.lower() == "y":
print("Yay\n")
else:
print("Oof\n")
if __name__ == '__main__':
main()
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter