beautifulsoup


Error whilst requesting a login to a site


last EDIT:
It seems that i am connecting to the website but for some reason i get an error with my code!Probably i do something wrong with BeautifulSouP.I am thinking that i should change somethin on the url variable!
def connect():
with requests.Session() as c:
urll2 = "http://www.oddscheck.net/inc/userlogin.php"
payload= {
'useremail': 'email#gmail.com',
'userpassword':'password',
'PHPSESSID' : 'ih79c4t5srr6p2',
'CF-RAY' : '35f784ad1-ATH'
}
headers = {}
headers['User-Agent'] = 'Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0'
c.post(urll2,data=payload,headers={"Referer": "http://www.oddscheck.net/?page=home&cmd=def"})
url = c.get('http://www.oddscheck.net/index.php?page=myaccount')
req = urllib.request.Request(url, headers=headers)
resp = urllib.request.urlopen(req)
soup = BS(resp, "html.parser")
gamesave = ""
for record in soup.find_all("tr"):
game = game1=""
for data in record.find_all("td"):
if data.get('class') == ['centertd', 'col_10']:
for link in data.find_all("a"):
game1 += ", "+"http://www.oddscheck.net/"+link.get('href')
else:
game += ","+data.text
game2 = game+game1
if len(game2) > 40:
gamesave += game[1:]+","+game1[1:]+"\n"
#header = "League,Time,1,X,2,U,O,Link"+"\n"
file = open(os.path.expanduser("Odss.txt"),"wb")
#file.write(bytes(header, encoding="UTF-8",errors="ignore"))
file.write(bytes(gamesave, encoding="UTF-8",errors="ignore"))
file.close()
ERROR I GET:
The error i get:
Traceback (most recent call last):
File "sportingbet.py", line 314, in <module>
connect()
File "sportingbet.py", line 27, in connect
req = urllib.request.Request(url, headers=headers)
File "/usr/lib/python3.5/urllib/request.py", line 269, in __init__
self.full_url = url
File "/usr/lib/python3.5/urllib/request.py", line 295, in full_url
self._parse()
File "/usr/lib/python3.5/urllib/request.py", line 324, in _parse
raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: 'Response [200]
urll = "http://www.oddscheck.net/inc/userlogin.php"
I'd take the extra 'l' out in urll
The client-side variable name for your URL must be consistent with that of the variable for the server-side. Assuming you already know the name of it, you should just be able to change it to that and have it run.

Related Links

Adjust the find_all() expression to find images as well
BeautifulSoup4 python3.6 impossible to get data in middle of the screen
How can i use a function in find_all() in BeautifulSoup
How do you use the beautiful soup module to click a link on a webpage repeatedly?
PyQt4 & BeautifulSoup setting the Browser Window Size
BS4: issues finding href of 2 tags
why the code of python2.7 have no any output?
Getting a specific part of a website with Beautiful Soup 4
LXML does not work when py script is converted to py exe
Issue with beautifulsoup
Beautiful Soup NoneType error
Why does bs4 return an empty list for this find_all() method? [duplicate]
How to use beautifulsoup to locate a <div> with text in its children
BeautifulSoup find by attribute value regardless of attribute
Error “global name 'BeautifulSoup' is not defined”
beautifulsoup get tags after <p> tag after <h3> and <br> tag between <p>

Categories

HOME
codenvy
gpu
angular-formly
apache-spark-mllib
yandex
g++
dkim
startup
automatic-ref-counting
magnetic-cards
wolframalpha
apache2.4
google-maps-autocomplete
slidetoggle
syntax-highlighting
stackexchange
gpio
pylons
android-things
paperjs
dotspatial
twos-complement
jwplayer6
mnist
processwire
openproject
imagenet
opensmpp
c9.io
glm-math
uiimage
facebook-social-plugins
dapper-simplecrud
puredata
openrasta
mschart
qtranslate
sundials
er-diagram
rsa-archer-grc
android-instrumentation
meteor-packages
async.js
watch-os-2
scaffolding
cifilter
respondcms
cfchart
nss
data-protection
turbo-prolog
pushbots
kendo-upload
piracy-prevention
mobiledoc-kit
relativelayout
custom-errors
vigenere
flock
google-books
android-launcher
evolus-pencil
rdflib
airbrake
graphics2d
alloy-ui
google-refine
snackbar
kubuntu
gamekit
browserify-shim
nsmenu
memset
authlogic
ebay-lms
kogrid
cmmi
stacky
preload
onmousemove
fragmenttransaction
dajaxice
faye
window-decoration
box2d-iphone
ikimagebrowserview
screen-size
htdocs
listactivity
exponentiation
dataform
office-2007
ajax-polling
folding
murmurhash
int64
wcf-proxy

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile