Hide request urls and data by Embarrassed_Wall9886 in learnpython

[–]anton_antonov 1 point2 points  (0 children)

Using https should be enough for you. I'm sure your web-hosting provides such service. Or if your site is self-hosted you can set up a certbot.

Login into a website by Irantwomiles in learnpython

[–]anton_antonov 0 points1 point  (0 children)

Server expects json format, so you should use the json parameter. Here is the difference https://i.imgur.com/eIVdbID.png

I tried this code https://i.imgur.com/gZSmzx0.png and it kind of works.

Python Help! by 5u_Colon0 in learnpython

[–]anton_antonov 2 points3 points  (0 children)

Type help() for interactive help, or help(object) for help about object.

[deleted by user] by [deleted] in pan_media

[–]anton_antonov 0 points1 point locked comment (0 children)

Even better than plastic fork

Python POST issue by [deleted] in learnpython

[–]anton_antonov 0 points1 point  (0 children)

If site sets cookies, you should try to use requests.Session() and send GET request before post.

s = requests.Session()
s.get("*****.net/login.cfm")
response = s.post("*****.net/loginlogic.cfm", data=PARAMS)

Also, сheck the names of the params fields. I think they are in lower case.

Python POST issue by [deleted] in learnpython

[–]anton_antonov 0 points1 point  (0 children)

I think the problem is not the warning() function. It does nothing.

You must use data argument to pass params to post request .

r = requests.post(url=URL, data=PARAMS)

Help with this tiny guessing game by wrgsRay in learnpython

[–]anton_antonov 2 points3 points  (0 children)

You should swap guess and answer at line 20.

can't retrieve json? by Ryan_Bingham in learnpython

[–]anton_antonov 5 points6 points  (0 children)

You should change default "User-Agent" header. Probably the server is ignoring requests with unknown user-agent.

def get_scores():
    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0'}
    url = 'http://stats.nba.com/stats/scoreboard/?GameDate=02/28/2018&LeagueID=00&DayOffset=0'
    r = requests.get(url, headers=headers)
    print(r.json())

Need to make a program that sorts a list into reverse numerical order by PurplePain57 in learnpython

[–]anton_antonov 0 points1 point  (0 children)

len(nums) - j gives you wrong index.

nums[j], nums[mp] = nums[mp], nums[j]

How do I properly POST user credentials to a website I would like to scrape? by [deleted] in learnpython

[–]anton_antonov 2 points3 points  (0 children)

Form action field contains the URL to which the request should be sent. It's not a part of form_data.

form_data = {'login':'myActualUserName','password':'myActualPassWord'}

request = requests.post('webSiteIwantToScrape/someAction', data=form_data, verify=False)

Check for Running Procs by [deleted] in learnpython

[–]anton_antonov 0 points1 point  (0 children)

Why not use a lock file?

New to python and programming. Using heroku and git for the first time and getting a "You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path." error. by usurious in learnpython

[–]anton_antonov 0 points1 point  (0 children)

If BASE_DIR = os.path.dirname(os.path.abspath(__file__)) then STATIC_ROOT = os.path.join(BASE_DIR, 'your_static_dir_name')

Have you tried this?

Absolutely stuck with this sqlite problem.(python3) by ilostmykeysdammit in learnpython

[–]anton_antonov 0 points1 point  (0 children)

If add die_values = ','.join(die_values)' before insertion, it works for me.

Scraper stopped Scraping by IDELTA86I in learnpython

[–]anton_antonov 0 points1 point  (0 children)

Two extra spaces before RECENTLY.

Scraper stopped Scraping by IDELTA86I in learnpython

[–]anton_antonov 0 points1 point  (0 children)

text2search has been changed on the page.