Skip to content

Commit

Permalink
batata
Browse files Browse the repository at this point in the history
  • Loading branch information
luis-cavano committed May 6, 2022
1 parent 3a8e27e commit c4f70e7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 49 deletions.
File renamed without changes.
29 changes: 14 additions & 15 deletions bot_teste.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@

def job():

urlMongo = "https://data.mongodb-api.com/app/data-pkmib/endpoint/data/beta/action/findOne"

url = requests.get('https://coinmarketcap.com/pt-br/currencies/bitcoin/')
htmlBruto = url.content
url1 = requests.get('https://coinmarketcap.com/pt-br/currencies/bitcoin/')
htmlBruto = url1.content
site = BeautifulSoup(htmlBruto, 'html.parser')
tagPreco = site.find('div', attrs={'class':'priceValue smallerPrice'})
preco = tagPreco.find('span')
time = datetime.now()
salvar = [preco.text, str(time)]

time = str(datetime.now())

url = "https://data.mongodb-api.com/app/data-pkmib/endpoint/data/beta/action/insertOne"
payload = json.dumps({
"collection": "routes",
"database": "sample_training",
"dataSource": "Cluster0",
"projection": {
"_id": 1
}
"collection": "testea",
"database": "teste",
"dataSource": "Cluster0",
"document": {
"preço": preco.text,
"horario": time
}
})
headers = {
'Content-Type': 'application/json',
Expand All @@ -34,7 +33,7 @@ def job():
print(response.text)

schedule.every(2).minutes.do(job)

while True:
schedule.run_pending()
#time.sleep(0)
time.sleep(0)
Empty file removed dados.csv
Empty file.
11 changes: 6 additions & 5 deletions mongo.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import requests
import json
url = "https://data.mongodb-api.com/app/data-pkmib/endpoint/data/beta/action/findOne"
url = "https://data.mongodb-api.com/app/data-pkmib/endpoint/data/beta/action/insertOne"
payload = json.dumps({
"collection": "routes",
"database": "sample_training",
"collection": "testea",
"database": "teste",
"dataSource": "Cluster0",
"projection": {
"_id": 1
"document": {
"nome":"luis",
"idade":"17"
}
})
headers = {
Expand Down
Empty file removed precos.txt
Empty file.
29 changes: 0 additions & 29 deletions webscraping2.py

This file was deleted.

0 comments on commit c4f70e7

Please sign in to comment.