473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem using post in urllb [solved]

Hi,

I am attempting to get quotes from several swedish lists of stocks like this:
Expand|Select|Wrap|Line Numbers
  1. data = {
  2. 'selected': "SEIO"
  3. }
  4. urldata = urllib.urlencode(data)
  5. f = urllib.urlopen("http://fp.ecovision.se/list.aspx?settings=Standard2",urldata)
  6.  
However, what I get back is the same whichever list I choose (here SEIO). So the urldata is wrong.
Looking into the source of the webpage http://fp.ecovision.se/list.aspx?settings=Standard2, I find the following javascript code:
Expand|Select|Wrap|Line Numbers
  1. <!--
  2.     function __doPostBack(eventTarget, eventArgument) {
  3.         var theform;
  4.         if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
  5.             theform = document.EcovisionForm;
  6.         }
  7.         else {
  8.             theform = document.forms["EcovisionForm"];
  9.         }
  10.         theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
  11.         theform.__EVENTARGUMENT.value = eventArgument;
  12.         theform.submit();
  13.     }
And in the HTML below, that function is called from a selection list like so:
[HTML]<select name="SelectList" onchange="__doPostBack('SelectList','')" language="javascript" id="SelectList" class="efaText">
<option value="OMXSLCAP">SSE Large Cap</option>
<option value="OMXSMCAP">SSE Mid Cap</option>
<option value="OMXSSCAP">SSE Small Cap</option>

<option selected="selected" value="SESHNGEQ">NGM Equity</option>
<option value="SESHTORG">Aktietorget</option>
<option value="SESHNYMA">First North</option>
<option value="SESHNGOT">Nordic OTC</option>
<option value="SEIO">beQuoted inofficiella</option>
<option value="SESHAEUR">Euronoteringar</option>
[/HTML]

I thought I understood the code, but obviously I am too much of a novice especially in javascript. Could anyone help me out? I am just getting started with urllib and this is an ideal exercise since I am interested in stock markets... ;)
Oct 28 '06 #1
4 1833
bartonc
6,596 Expert 4TB
I'll bet that kudos can answer this one for you.
Oct 28 '06 #2
I'll bet that kudos can answer this one for you.
So should I contact him or is that a breach of netiquette?
Oct 29 '06 #3
kudos
127 Expert 100+
So should I contact him or is that a breach of netiquette?
Okay, here is the reply. This page obviously use session variables and things like that. What I would do, is the following; Get some kind of tool that display http traffic, such a tool can be "Live HTTP headers" (for firefox, there is some simillar tool for IE, but I can't remeber the name). Install this tool, and select one of the list, you can then study it in Live HTTP headers. For instance, assume that I select "Aktietorget", in the Live HTTP header, I would see the following;

Referer: http://fp.ecovision.se/list.aspx?settings=Standard2

(thats the addess right)

Content-length: 3912
--- _EVENTARGET=SelectList&....blalala

(this is obviously the post variables, I cutted it, since it too long to post here).

Okay, now were almost done, you need to combine the address with Content-length part, like this

http://fp.ecovision.se/list.aspx?settings=Standard2& _EVENTARGET=SelectList&....blalala

(note the &)

Do this for all the lists (hey its only 9 in total).
Try to add this addresses in urllib, and let me know how it worked?
(I have some other idea if it doesn't)

-kudos
Oct 30 '06 #4
Hi Kudos,

Thanks a lot for your help, your suggestion worked like a charm!
It took me a little time to get access to a windows machine but once there it took 5 minutes to test the idea.

Thanks again!
Oct 31 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Vinay Aggarwal | last post by:
I have been thinking about the lazy initialization and double checked locking problem. This problem is explain in detail here http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html...
0
by: Andreas Suurkuusk | last post by:
Hi, I just noticed your post in the "C# memory problem: no end for our problem?" thread. In the post you implied that I do not how the garbage collector works and that I mislead people. Since...
2
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
9
by: Theodore A. Jencks | last post by:
Hi All, I have a problem that is two fold. First a little about the enviroment I'm using; I am running Microsoft Windows XP with all security patches applied. I use Mozilla 1.6 for all testing...
11
by: EDom | last post by:
Hi, I have aspnet_wp.exe with increasing on every postback and not every revisit to any page. Even if I clear session and close the browser it remains in the memory. I have only one connection...
43
by: balakrishnan.dinesh | last post by:
Hi all, Im working in javascript, I want to use Ajax in javcascript, Can u tel me how to use ajax in javascript, whether i have to include any code as like to include *css or *.js file, what are...
0
by: deacon57 | last post by:
FYI - If you are a computer scientist (or geek), this post may be for you. I wanted to log any search keywords, etc that are used on my site. I created a simple program that logs search terms...
5
by: Chelong | last post by:
hey,the follow is the text file content ========================================apple====pear== one Lily 7 0 0 7 7 two Lily 20 20 6.6666 20 8 one Lily 0 10 2.85 4 0 two Lily 22 22 7.33326 2 5 ...
2
by: =?Utf-8?B?aGVsZmk=?= | last post by:
Hi all, I have replied with my own questions to an older post entry but after a while I thought it's better to start a new thread based on the previous one. Perhaps with the new thread I will...
4
by: szimek | last post by:
Hi, I've already posted an email with this problem, but this time I think I got a bit more info. The app I'm currently working on works like this: when user clicks on a clickable element, it...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.