www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - requests module generates " Can't parse uri '' "

reply cartland <example example.com> writes:
First time D use :)

After dub init, I used the example from 
https://code.dlang.org/packages/requests and ran "dub add 
requests"

When I run dub, I get

requests.uri.UriException /home/cartland/.dub/packages/requests-1.0.9/requests/source
requests/uri.d(35): Can't parse uri ''

Full output on initial run:

Fetching vibe-core 1.7.0 (getting selected version)...
Fetching requests 1.0.9 (getting selected version)...
Fetching memutils 0.4.13 (getting selected version)...
Fetching taggedalgebraic 0.11.7 (getting selected version)...
Fetching vibe-d 0.8.6 (getting selected version)...
Fetching botan-math 1.0.3 (getting selected version)...
Fetching stdx-allocator 2.77.5 (getting selected version)...
Fetching botan 1.12.10 (getting selected version)...
Fetching diet-ng 1.6.0 (getting selected version)...
Fetching openssl 1.1.6+1.0.1g (getting selected version)...
Fetching cachetools 0.3.1 (getting selected version)...
Fetching eventcore 0.8.48 (getting selected version)...
Fetching mir-linux-kernel 1.0.1 (getting selected version)...
Fetching libevent 2.0.2+2.0.16 (getting selected version)...
Fetching libasync 0.8.4 (getting selected version)...
Performing "debug" build using 
/home/cartland/dlang/dmd-2.089.0/linux/bin64/dmd for x86_64.
cachetools 0.3.1: building configuration "library"...
requests 1.0.9: building configuration "std"...
x ~master: building configuration "application"...
Linking...
Running ./x
requests.uri.UriException /home/cartland/.dub/packages/requests-1.0.9/requests/source
requests/uri.d(35): Can't parse uri ''
Program exited with code 1
Nov 07 2019
next sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 8 November 2019 at 03:29:41 UTC, cartland wrote:
 When I run dub, I get
What was your main() code? The error makes me think you might have just tried like get("") or something
Nov 07 2019
parent reply cartland <example example.com> writes:
On Friday, 8 November 2019 at 03:31:56 UTC, Adam D. Ruppe wrote:
 On Friday, 8 November 2019 at 03:29:41 UTC, cartland wrote:
 When I run dub, I get
What was your main() code? The error makes me think you might have just tried like get("") or something
import std.stdio; import requests; void main() { auto content = getContent("https://httpbin.org/get", queryParams("name", "any name", "age", 42)); writeln(content); }
Nov 07 2019
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 8 November 2019 at 03:36:22 UTC, cartland wrote:
 * snip *
huh, idk, it works when I try that exact code in a fresh project dub init dub add requests dub run and it spat out the content... are you behind a proxy or something maybe?
Nov 07 2019
parent cartland <example example.com> writes:
On Friday, 8 November 2019 at 03:43:52 UTC, Adam D. Ruppe wrote:
 On Friday, 8 November 2019 at 03:36:22 UTC, cartland wrote:
 * snip *
huh, idk, it works when I try that exact code in a fresh project
 * snip *
are you behind a proxy or something maybe?
Thanks for checking. I'm not behind a proxy. The firewall allows browsing to the url. Also tried older versions of requests with the same result. The same (similar) call works using std.net.curl. I'm on Tumbleweed. I'll try it on MacOS. And also try a different network a bit later.
Nov 07 2019
prev sibling parent reply ikod <igor.khasilev gmail.com> writes:
On Friday, 8 November 2019 at 03:29:41 UTC, cartland wrote:
 First time D use :)

 After dub init, I used the example from 
 https://code.dlang.org/packages/requests and ran "dub add 
 requests"

 [...]
If you still stuck with this problem, you can post new issue on github project page, I'll try to solve it. https://github.com/ikod/dlang-requests
Nov 08 2019
parent reply cartland <example example.com> writes:
On Friday, 8 November 2019 at 17:01:07 UTC, ikod wrote:
 On Friday, 8 November 2019 at 03:29:41 UTC, cartland wrote:
 First time D use :)

 After dub init, I used the example from 
 https://code.dlang.org/packages/requests and ran "dub add 
 requests"

 [...]
If you still stuck with this problem, you can post new issue on github project page, I'll try to solve it. https://github.com/ikod/dlang-requests
Same on MacOS. Using dmd, ldc, or gdc. I'll raise an issue on https://github.com/ikod/dlang-requests. Even this does it. import requests; void main() { }
Nov 08 2019
parent reply cartland <example example.com> writes:
On Saturday, 9 November 2019 at 00:53:13 UTC, cartland wrote:
 On Friday, 8 November 2019 at 17:01:07 UTC, ikod wrote:
 *snip*
 Even this does it.

 import requests;
 void main() {
 }
https://github.com/ikod/dlang-requests/issues/109
Nov 08 2019
parent reply cartland <example example.com> writes:
On Saturday, 9 November 2019 at 01:02:57 UTC, cartland wrote:
 On Saturday, 9 November 2019 at 00:53:13 UTC, cartland wrote:
 On Friday, 8 November 2019 at 17:01:07 UTC, ikod wrote:
 *snip*
 Even this does it.

 import requests;
 void main() {
 }
https://github.com/ikod/dlang-requests/issues/109
Figured it out. See github issue. I had http_proxy env var set to blank. Worked when I unset it.
Nov 09 2019
next sibling parent cartland <example example.com> writes:
On Sunday, 10 November 2019 at 01:28:13 UTC, cartland wrote:
 On Saturday, 9 November 2019 at 01:02:57 UTC, cartland wrote:
 On Saturday, 9 November 2019 at 00:53:13 UTC, cartland wrote:
 On Friday, 8 November 2019 at 17:01:07 UTC, ikod wrote:
 *snip*
 Even this does it.

 import requests;
 void main() {
 }
https://github.com/ikod/dlang-requests/issues/109
Figured it out. See github issue. I had http_proxy env var set to blank. Worked when I unset it.
D. Very impressive so far.
Nov 09 2019
prev sibling next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
On Sunday, 10 November 2019 at 01:28:13 UTC, cartland wrote:
 I had http_proxy env var set to blank. Worked when I unset it.
Hah, I called it! But I didn't realize an env var would do it with blank. That's kinda crazy, the code should prolly check that; I'd call it a bug.
Nov 09 2019
prev sibling parent ikod <geller.garry gmail.com> writes:
On Sunday, 10 November 2019 at 01:28:13 UTC, cartland wrote:
 On Saturday, 9 November 2019 at 01:02:57 UTC, cartland wrote:
 On Saturday, 9 November 2019 at 00:53:13 UTC, cartland wrote:
 On Friday, 8 November 2019 at 17:01:07 UTC, ikod wrote:
 *snip*
 Even this does it.

 import requests;
 void main() {
 }
https://github.com/ikod/dlang-requests/issues/109
Figured it out. See github issue. I had http_proxy env var set to blank. Worked when I unset it.
Thanks for report, fixed in latest release.
Nov 10 2019